Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
QB QB is offline
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
QB QB is offline
external usenet poster
 
Posts: 57
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Web Components yaanai Excel Discussion (Misc queries) 0 February 7th 08 04:42 AM
Splitting strings, error subscript out of range [email protected] Excel Programming 5 November 9th 07 02:25 PM
VBA Vs .net components avi Excel Programming 1 October 1st 07 06:35 PM
splitting values into a range andrew1987 Excel Discussion (Misc queries) 2 January 9th 06 04:14 PM
Missing WrapText from range object in Office Web Components Ricci Gian Maria Excel Programming 0 May 21st 05 10:29 AM


All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"