Excel VBA Loop on columns

The Solution to Excel VBA Loop on columns is

Yes, let's use Select as an example

sample code: Columns("A").select

How to loop through Columns:

Method 1: (You can use index to replace the Excel Address)

For i = 1 to 100
next i

Method 2: (Using the address)

For i = 1 To 100
Next i

EDIT: Strip the Column for OP

columnString = Replace(Split(Columns(27).Address, ":")(0), "$", "")

e.g. you want to get the 27th Column --> AA, you can get it this way

~ Answered on 2012-12-21 06:31:33

Most Viewed Questions: