PDA

View Full Version : [SOLVED:] Selecting named columns



AJS
09-28-2005, 05:25 PM
Hi All,

Does anyone know how I could select a range of columns between one named column and a second named column?

Thanks, Aaron

MWE
09-28-2005, 06:28 PM
Hi All,

Does anyone know how I could select a range of columns between one named column and a second named column?

Thanks, Aaron
Are the "named columns" named ranges? or do they have a name/title at the top (typically the first row of the relevant column)? something else?

AJS
09-28-2005, 09:25 PM
The named columns are named ranges.

Bob Phillips
09-28-2005, 10:28 PM
Range(Range("range1")(1, 1).Offset(0, 1).Address, _
Range("range2")(1, 1).Offset(0, -1).Address).EntireColumn.Select

AJS
09-28-2005, 10:49 PM
This is close, but I should clarify what I'm after. I don't want to select the entire columns - I start off with a range of entire rows selected, which I want to reduce to a range that comprises the area between the named columns and the previously selected rows...

Thanks, Aaron

AJS
09-28-2005, 11:05 PM
Hi All,

Got it! Thanks for all your help. FYI, the final code was:


Sub ColSel()
Dim FirstRow As Integer
Dim NumPoints As Integer
NumPoints = Selection.Rows.Count
FirstRow = ActiveCell.Row
Range(Range("No.")(1, 1).Offset(FirstRow - 1, 0).Address, Range("Comment")(NumPoints, 1).Offset(FirstRow - 1, 0).Address).Select
End Sub

Thanks, Aaron