For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > March 2006 > How do I increment the cellnumber in VBA for Excel









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do I increment the cellnumber in VBA for Excel
den1s

2006-03-31, 3:55 am

Hi,

I would like the output of my code to start in "A1" and either store
data laterally "B1", "C1" etc or vertically i.e. "A2", "A3" etc etc.

could someone help me with the relevant command?

Bob Butler

2006-03-31, 7:55 am

"den1s" <dingoboy79@gmail.com> wrote in message
news:1143783212.511009.287700@v46g2000cwv.googlegroups.com
> Hi,
>
> I would like the output of my code to start in "A1" and either store
> data laterally "B1", "C1" etc or vertically i.e. "A2", "A3" etc etc.
>
> could someone help me with the relevant command?


You should probably be asking in an Excel VBA newsgroup as this group is for
the full VB product

That said, IMO it's easiest to use the Cells object
for r=1 to 5
for c=1 to 5
worksheet.cells(r,c)=r & "," & c
next
next

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Jeff Johnson [MVP: VB]

2006-03-31, 6:55 pm


"den1s" <dingoboy79@gmail.com> wrote in message
news:1143783212.511009.287700@v46g2000cwv.googlegroups.com...

> I would like the output of my code to start in "A1" and either store
> data laterally "B1", "C1" etc or vertically i.e. "A2", "A3" etc etc.
>
> could someone help me with the relevant command?


Look into the Offset method of the Range object. And then take your
questions to microsoft.public.excel.programming, as you'll find more Excel
VBA experts there than here.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com