Define Variable Name using VBA

G

GTReferee

I have a worksheet that I copy infor into. The information varies from paste
to paste. When I define a cell with a name, it can change from paste to
paste. I need to be able to find the required data "Original Amou" , then tab
to the next cell and define the cell as RegisteredAmountOwing. Then I ahve a
formula that captures the amount and creates a sentence such as "Amount owing
= $43,623.62".

Original Amou $43,623.62

Can someone help me with the code for defining the name each time I paste. i
already have the following code to find the name and tab to the cell:

Cells.Find(What:="original amou", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Cells.Find(What:="original amou", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
 
J

Joel

set c = Cells.Find(What:="original amou", _
LookIn:=xlFormulas, LookAt:=xlPart)
set c = Cells.Find(What:="original amou", After:=c, _
LookIn:=xlFormulas, LookAt:=xlPart)

c.Offset(0, 1).Select
 
T

Tony

Joel, the first part works great finding the cell. Now I be able to do a
Name/Define for that cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top