Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Splitting Range into it's components
I used vba to make a range selection. When I do the following in the
immediate window ?Selection.address $E$3:$DC$62 Which is great, but I need to split this into it's various component. IE: Start Col = E, Start Row = 3, End Col = DC and End Row = 62. How can I do this without reinventing the wheel? I'm assuming the is a built in method that I am simply unaware of. Thank you, QB |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Splitting Range into it's components
One way... (note it rueurns the column number instead of letter)
With Selection(1) MsgBox .Row MsgBox .Column End With With Selection(Selection.Cells.Count) MsgBox .Row MsgBox .Column End With -- HTH... Jim Thomlinson "QB" wrote: I used vba to make a range selection. When I do the following in the immediate window ?Selection.address $E$3:$DC$62 Which is great, but I need to split this into it's various component. IE: Start Col = E, Start Row = 3, End Col = DC and End Row = 62. How can I do this without reinventing the wheel? I'm assuming the is a built in method that I am simply unaware of. Thank you, QB |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Splitting Range into it's components
Nothing built-in, but easy to do...
Dim StartCol As String, EndCol As String Dim StartRow As Long, EndRow As Long Dim Addr() As String With Selection Addr = Split(Replace(.Address(1, 0), ":", "$"), "$") StartCol = Addr(0) StartRow = Addr(1) EndCol = Addr(UBound(Addr) - 1) EndRow = Addr(UBound(Addr)) End With -- Rick (MVP - Excel) "QB" wrote in message ... I used vba to make a range selection. When I do the following in the immediate window ?Selection.address $E$3:$DC$62 Which is great, but I need to split this into it's various component. IE: Start Col = E, Start Row = 3, End Col = DC and End Row = 62. How can I do this without reinventing the wheel? I'm assuming the is a built in method that I am simply unaware of. Thank you, QB |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Splitting Range into it's components
Worked beautifully! Thank you for your help.
"Jim Thomlinson" wrote: One way... (note it rueurns the column number instead of letter) With Selection(1) MsgBox .Row MsgBox .Column End With With Selection(Selection.Cells.Count) MsgBox .Row MsgBox .Column End With -- HTH... Jim Thomlinson "QB" wrote: I used vba to make a range selection. When I do the following in the immediate window ?Selection.address $E$3:$DC$62 Which is great, but I need to split this into it's various component. IE: Start Col = E, Start Row = 3, End Col = DC and End Row = 62. How can I do this without reinventing the wheel? I'm assuming the is a built in method that I am simply unaware of. Thank you, QB |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MS Web Components | Excel Discussion (Misc queries) | |||
Splitting strings, error subscript out of range | Excel Programming | |||
VBA Vs .net components | Excel Programming | |||
splitting values into a range | Excel Discussion (Misc queries) | |||
Missing WrapText from range object in Office Web Components | Excel Programming |