Increment cell prefix

G

Guest

Within a macro I want to go to the next cell across. I know I can do it by
using offset, but is there a way I can just increment "A" to "B" in the same
way that I can increment down a row from 1 to 2 by using 1 + 1?

e.g. I can go a cell down by using:
Range("A" & Counter).Select
Counter = Counter + 1
Range("A" & Counter).Select

but how do I use similar code to increment across (or back)? I want to use
this in a loop for a variable cell prefix.
Thanks & Regards, Brett
 
G

Guest

You do the same with columns as with rows for example:-

Sub fillrow()
For x = 1 To 256
Cells(1, x).Value = x
Next
End Sub

Will put the numbers 1 to 256 across row 1 in a worksheet,

Mike
 

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