Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Range row Address.

Hi All,

I have a problem and here it is.

For example I have selected a range i.e A10:A19 in excel.

I want A10 as my start point and A19 as my end point in excel
basically I want the start row number and the end row number so that I
can write a procedure in VBA as mentioned below.

Dim Spoint as integer
Dim Epoint as integer

Spoint = 10
Epoint = 19

I tried working around with the below mentioned code but I am not able
come at a solution.

ActiveWindow.RangeSelection.Address(False, False)

Regards
Heera
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Range row Address.


Sub test()

Dim rng As Range
Set rng = Selection

Dim spt As Integer
Dim ept As Integer


spt = rng.Cells(1, 1).Row
ept = spt + rng.Rows.Count - 1

MsgBox "Starts: " & spt
MsgBox "End: " & ept

End Sub

"Heera" wrote:

Hi All,

I have a problem and here it is.

For example I have selected a range i.e A10:A19 in excel.

I want A10 as my start point and A19 as my end point in excel
basically I want the start row number and the end row number so that I
can write a procedure in VBA as mentioned below.

Dim Spoint as integer
Dim Epoint as integer

Spoint = 10
Epoint = 19

I tried working around with the below mentioned code but I am not able
come at a solution.

ActiveWindow.RangeSelection.Address(False, False)

Regards
Heera

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Range row Address.

Can you not use the Range object?

Dim rng as Range

For each rng in selection
'Do whatever you want here
loop

HTH
Rob
"Heera" wrote:

Hi All,

I have a problem and here it is.

For example I have selected a range i.e A10:A19 in excel.

I want A10 as my start point and A19 as my end point in excel
basically I want the start row number and the end row number so that I
can write a procedure in VBA as mentioned below.

Dim Spoint as integer
Dim Epoint as integer

Spoint = 10
Epoint = 19

I tried working around with the below mentioned code but I am not able
come at a solution.

ActiveWindow.RangeSelection.Address(False, False)

Regards
Heera

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Range row Address.

Heera,

Dim Spoint As Long
Dim Epoint As Long

Spoint = Selection.Cells(1).Row
Epoint = Selection.Cells(Selection.Cells.Count).Row


Or you could simply use:

Dim myC As Range

For Each myC In Selection
'do stuff to/with myC
Next myC

HTH,
Bernie
MS Excel MVP


"Heera" wrote in message
...
Hi All,

I have a problem and here it is.

For example I have selected a range i.e A10:A19 in excel.

I want A10 as my start point and A19 as my end point in excel
basically I want the start row number and the end row number so that I
can write a procedure in VBA as mentioned below.

Dim Spoint as integer
Dim Epoint as integer

Spoint = 10
Epoint = 19

I tried working around with the below mentioned code but I am not able
come at a solution.

ActiveWindow.RangeSelection.Address(False, False)

Regards
Heera



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Range row Address.

thanks lot....you are great.............
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
How to create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
getting the absolute range address from a dynamic named range junoon Excel Programming 2 March 21st 06 01:29 PM
Return Range Address from Active Range ExcelMonkey Excel Programming 1 February 10th 06 12:00 PM
select range and put range address in variable [email protected] Excel Programming 2 January 25th 06 01:28 AM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM


All times are GMT +1. The time now is 02:33 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"