![]() |
Define Variable Name using VBA
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 -- GTReferee |
Define Variable Name using VBA
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 "GTReferee" wrote: 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 -- GTReferee |
Define Variable Name using VBA
Joel, the first part works great finding the cell. Now I be able to do a Name/Define for that cell. "Joel" wrote: 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 "GTReferee" wrote: 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 -- GTReferee |
All times are GMT +1. The time now is 09:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com