I am trying to select a column (12) over multiple selctions. I can use the Range.Columns(12) but this only selects the column in the first selection of the multiple selections.
On investigation I thought I may be able to use the Areas command, but have run into difficulties. rRange is the multiple selection from a user input. The macro should number each Area of rRange, then look to select Column 12 within each Area, applying a formula to each cell in the column of each area, then repeat for each of the Areas (could be 1 - 35).
Unfortunately I get a "runtime error 9" error, with "with subscript out of range error" and the line Set fRange(i) = SelAreas(i).Columns(12) selected.
I haven't attempted anything like this before so school boy errors are a distinct possibility!
' Macro
NumAreas = Selection.Areas.Count
ReDim SelAreas(1 To NumAreas)
For i = 1 To NumAreas
Set SelAreas(i) = rRange.Areas(i)
Next
For i = 1 To NumAreas
Set fRange(i) = SelAreas(i).Columns(12)
fRange(i).Select
dValue = rRange.Row
Selection.Formula = "=VLOOKUP($A" & dValue & ",'Summary'!$D$1:$J$1500,7,TRUE)"
Selection.Font.Bold = True
Next i
On investigation I thought I may be able to use the Areas command, but have run into difficulties. rRange is the multiple selection from a user input. The macro should number each Area of rRange, then look to select Column 12 within each Area, applying a formula to each cell in the column of each area, then repeat for each of the Areas (could be 1 - 35).
Unfortunately I get a "runtime error 9" error, with "with subscript out of range error" and the line Set fRange(i) = SelAreas(i).Columns(12) selected.
I haven't attempted anything like this before so school boy errors are a distinct possibility!
' Macro
NumAreas = Selection.Areas.Count
ReDim SelAreas(1 To NumAreas)
For i = 1 To NumAreas
Set SelAreas(i) = rRange.Areas(i)
Next
For i = 1 To NumAreas
Set fRange(i) = SelAreas(i).Columns(12)
fRange(i).Select
dValue = rRange.Row
Selection.Formula = "=VLOOKUP($A" & dValue & ",'Summary'!$D$1:$J$1500,7,TRUE)"
Selection.Font.Bold = True
Next i