Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

loop through columns (using for-loop)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kurt - 23 Nov 2007 19:08 GMT
Hello,

I now discovered the syntax to loop through rows:
example:

   For i = 3 To 20
       If Range("A" & i).Value = "" Then
       Range("A" & 1).Copy Destination:=Range("A" & i)
   End If
   Next i

How can I use the same method for scrolling trough columns?
How can I get to column B using something like "A+1"

extra question: why is the "Next i" placed behind the for-loop? Isn't
it placed in the for-loop with other languages?

Thanks in advance!
Per Jessen - 23 Nov 2007 19:31 GMT
> Hello,
>
[quoted text clipped - 14 lines]
>
> Thanks in advance!

Hi Kurt

MyRow = 1
For i = 3 To 20
   If Cells(MyRow, i).Value = "" Then Cells(MyRow, i) = Cells(MyRow,
1).Value
Next

Regards,

Per
JLGWhiz - 23 Nov 2007 20:56 GMT
Here is a place to answer some questions:

http://www.excel-vba.com/excel-vba-contents.htm

Just start at the beginning and work your way through.  It explains a lot of
the basics and gives examples..

> Hello,
>
[quoted text clipped - 14 lines]
>
> Thanks in advance!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.