Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I move the cellpointer in VBA? 1

Status
Not open for further replies.

AncientTiger

Programmer
Joined
Jul 5, 2001
Messages
238
Location
US
Forgive an old Lotus Script programmer, but I'm trying to figure out how to translate what I use in Lscript to VBA....

What I need to do is set up a script to move the cell pointer down incrementally and search cells for certain text. In lotus script it would work like this:
[a1].select
x = selection.contents
while x <>&quot;&quot;
if x = whatever then do action
.movecellpointer $down,1
x = selection.contents
wend

but I have not idea how VBA moves the cell pointer....

Thanks
AT
 
dim i as INTEGER
i=1
x=Cells(i,1).select'Picks cell A1 and sets x=A1

while (x <>&quot;&quot;)
if x = whatever then do action
i=i+1
x=Cells(i,1).select'Picks the next cell A1 and sets x=to the new cell
next i

The cells() syntax is cells(Row, Column)

Hope this helps you

 
Sorry, typo in there.


while (x <>&quot;&quot;)
if x = whatever then do action
i=i+1
x=Cells(i,1).select'Picks the next cell past A1 and sets x=to the new cell
next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top