How can i cycle through columns using vba, looping they rows is easy as its a number and i can add 1 to go to next row but column is an alphabet, how can i go to next column from a reference cell.
How can i cycle through columns using vba, looping they rows is easy as its a number and i can add 1 to go to next row but column is an alphabet, how can i go to next column from a reference cell.
Columns can be refered to by numbers as well as letters.
here is a couple of ways
Dim iCol As Integer
For iCol = 1 To 10
MsgBox Cells(1, iCol).Value
Next ifor
For iCol = 1 To 10
MsgBox Range("a1").Offset(0, ifor).Value
Next ifor
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks