Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub demo()
Const COL_FIRSTCOL = 4 ' Column "D"
Const COL_LASTCOL = 14 ' Column "N"
Dim rColumn As Range
Dim c As Range
Dim nCol As Integer
Dim nFirstRow As Long
Dim nLastRow As Long
With ActiveSheet.UsedRange
nFirstRow = .Row
nLastRow = .Rows.Count + .Row - 1
End With
For nCol = COL_FIRSTCOL To COL_LASTCOL
Set rColumn = Range(Cells(nFirstRow, nCol), _
Cells(nLastRow, nCol))
For Each c In rColumn
MsgBox c.Address
Next c
Next nCol
Set rColumn = Nothing
End Sub
Option Explicit
Sub demo()
Dim rColumn As Range
Dim c As Range
Dim aColumnIDs As Variant
Dim aColumns(7) As Integer
Dim i As Integer
Dim nCol As Integer
Dim nFirstRow As Long
Dim nLastRow As Long
aColumnIDs = Array("D", "E", "G", "H", "I", "K", "L", "N")
For i = 0 To 7
aColumns(i) = Asc(aColumnIDs(i)) - Asc("A") + 1
Next i
With ActiveSheet.UsedRange
nFirstRow = .Row
nLastRow = .Rows.Count + .Row - 1
End With
For i = 0 To 7
nCol = aColumns(i)
Set rColumn = Range(Cells(nFirstRow, nCol), _
Cells(nLastRow, nCol))
For Each c In rColumn
MsgBox c.Address
Next c
Next i
Set rColumn = Nothing
End Sub
Sub demoToo()
Dim rColumn As Range
Dim c As Range
Dim aColumnIDs As Variant
Dim i As Integer
Dim nFirstRow As Long
Dim nLastRow As Long
aColumnIDs = Array(4, 5, 7, 8, 9, 11, 12, 14)
With ActiveSheet.UsedRange
nFirstRow = .Row
nLastRow = .Rows.Count + .Row - 1
End With
For i = LBound(aColumnIDs) To UBound(aColumnIDs)
Set rColumn = Range(Cells(nFirstRow, aColumnIDs(i)), _
Cells(nLastRow, aColumnIDs(i)))
For Each c In rColumn
MsgBox c.Address
Next c
Next i
Set rColumn = Nothing
End Sub