#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default range row

What is the best way to take a range and then change the row of it.
Say my range is Range("myRange") which might be C5
I can do a .address then try to parse out the row. and put in my new row.
such as 10
but that is a kludge.

it seems like you can use .cell(5) but you need to know the offset.

is there a way to directly change a ranges row?
thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default range row

If I read correctly you want the row portion of a range returned, right?
Yes, you can do that. In your case this is how:

Sub RangeRow()

Dim myRangeRow As Long

myRangeRow = Sheets("Sheet1").Range("C5").Row

MsgBox "myRange is on Row " & myRangeRow

End Sub

Hope this helps!
--
Cheers,
Ryan


"greg" wrote:

What is the best way to take a range and then change the row of it.
Say my range is Range("myRange") which might be C5
I can do a .address then try to parse out the row. and put in my new row.
such as 10
but that is a kludge.

it seems like you can use .cell(5) but you need to know the offset.

is there a way to directly change a ranges row?
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default range row

Actually
I would like to end up with a range. that is the same column. and a new
row.


"RyanH" wrote in message
...
If I read correctly you want the row portion of a range returned, right?
Yes, you can do that. In your case this is how:

Sub RangeRow()

Dim myRangeRow As Long

myRangeRow = Sheets("Sheet1").Range("C5").Row

MsgBox "myRange is on Row " & myRangeRow

End Sub

Hope this helps!
--
Cheers,
Ryan


"greg" wrote:

What is the best way to take a range and then change the row of it.
Say my range is Range("myRange") which might be C5
I can do a .address then try to parse out the row. and put in my new
row.
such as 10
but that is a kludge.

it seems like you can use .cell(5) but you need to know the offset.

is there a way to directly change a ranges row?
thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default range row

I'm not sure how you want the Range Row changed. If you have code that you
need help with I would suggest posting it or give a little better detail.

--
Cheers,
Ryan


"greg" wrote:

Actually
I would like to end up with a range. that is the same column. and a new
row.


"RyanH" wrote in message
...
If I read correctly you want the row portion of a range returned, right?
Yes, you can do that. In your case this is how:

Sub RangeRow()

Dim myRangeRow As Long

myRangeRow = Sheets("Sheet1").Range("C5").Row

MsgBox "myRange is on Row " & myRangeRow

End Sub

Hope this helps!
--
Cheers,
Ryan


"greg" wrote:

What is the best way to take a range and then change the row of it.
Say my range is Range("myRange") which might be C5
I can do a .address then try to parse out the row. and put in my new
row.
such as 10
but that is a kludge.

it seems like you can use .cell(5) but you need to know the offset.

is there a way to directly change a ranges row?
thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default range row

Well, I Could do something like this:

Dim vTmp As Variant
Dim sAddress As String
Dim objRange As Range
Dim iNewRow As Integer

iNewRow = 50

sAddress = Excel.Range("myRange").Address
vTmp = Split(sAddress, "$")
Set objRange = Range(vTmp(1) & CStr(iNewRow))


But I am wondering if excel has something built in to Range to just change
the Row. To make this prettier.

thanks for any help



"RyanH" wrote in message
...
I'm not sure how you want the Range Row changed. If you have code that you
need help with I would suggest posting it or give a little better detail.

--
Cheers,
Ryan


"greg" wrote:

Actually
I would like to end up with a range. that is the same column. and a new
row.


"RyanH" wrote in message
...
If I read correctly you want the row portion of a range returned,
right?
Yes, you can do that. In your case this is how:

Sub RangeRow()

Dim myRangeRow As Long

myRangeRow = Sheets("Sheet1").Range("C5").Row

MsgBox "myRange is on Row " & myRangeRow

End Sub

Hope this helps!
--
Cheers,
Ryan


"greg" wrote:

What is the best way to take a range and then change the row of it.
Say my range is Range("myRange") which might be C5
I can do a .address then try to parse out the row. and put in my new
row.
such as 10
but that is a kludge.

it seems like you can use .cell(5) but you need to know the offset.

is there a way to directly change a ranges row?
thanks








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 do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


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