Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Changing Properties of a Range object after initial Dimensions ??

Hi there I don't know if this is posible or not but I would like to think so.

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Row - 1
End Sub
What I am trying to do is change just the Row property of my range object
without having to redeclare it as...
Set BaseDateRng = Worksheets("Sheet1").Range("A1:D10")

I should be able to just alter reset or redim or something the "row"
property of my range object. Is this posible and if so what is the corect
syntax for doing it ??

Thanks, Dan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Changing Properties of a Range object after initial Dimensions ??

AFAIK, the Row property of a range is read-only. It's the absolute row number
on the worksheet.

Maybe you're looking for

Set BaseDateRng = BaseDateRng.Offset(-1, 0)

On Tue, 2 Nov 2004 15:25:02 -0800, Dan Thompson
wrote:

Hi there I don't know if this is posible or not but I would like to think so.

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Row - 1
End Sub
What I am trying to do is change just the Row property of my range object
without having to redeclare it as...
Set BaseDateRng = Worksheets("Sheet1").Range("A1:D10")

I should be able to just alter reset or redim or something the "row"
property of my range object. Is this posible and if so what is the corect
syntax for doing it ??

Thanks, Dan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Changing Properties of a Range object after initial Dimensions ??

If r is your range

Set r = r.Resize(r.Rows.Count - 1, r.Columns.Count).Offset(1, 0)

makes the range on row shorter and shifts it down one row.

Tim.

"Dan Thompson" wrote in message
...
Hi there I don't know if this is posible or not but I would like to think

so.

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Row - 1
End Sub
What I am trying to do is change just the Row property of my range object
without having to redeclare it as...
Set BaseDateRng = Worksheets("Sheet1").Range("A1:D10")

I should be able to just alter reset or redim or something the "row"
property of my range object. Is this posible and if so what is the corect
syntax for doing it ??

Thanks, Dan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing Properties of a Range object after initial Dimensions ??

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Offset(-1, 0) _
.Resize(BaseDateRng.Rows.Count + 1)
Debug.Print BaseDateRng.Address
End Sub

produces

$A$1:$D$10

--
Regards,
Tom Ogilvy



"Dan Thompson" wrote in message
...
Hi there I don't know if this is posible or not but I would like to think

so.

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Row - 1
End Sub
What I am trying to do is change just the Row property of my range object
without having to redeclare it as...
Set BaseDateRng = Worksheets("Sheet1").Range("A1:D10")

I should be able to just alter reset or redim or something the "row"
property of my range object. Is this posible and if so what is the corect
syntax for doing it ??

Thanks, Dan




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Changing Properties of a Range object after initial Dimensions ??

"Tim Williams" <saxifrax at pacbell dot net wrote in message
...
If r is your range

Set r = r.Resize(r.Rows.Count - 1, r.Columns.Count).Offset(1, 0)

makes the range on row shorter and shifts it down one row.



...... which of course is *not* what was required (but hey, you might need
to do it some day).

Yim.



"Dan Thompson" wrote in message
...
Hi there I don't know if this is posible or not but I would like to

think
so.

Sub Test()
Dim BaseDateRng As Range
Set BaseDateRng = Worksheets("Sheet1").Range("A2:D10")
'This line below is wrong and doesn't work
Set BaseDateRng = BaseDateRng.Row - 1
End Sub
What I am trying to do is change just the Row property of my range

object
without having to redeclare it as...
Set BaseDateRng = Worksheets("Sheet1").Range("A1:D10")

I should be able to just alter reset or redim or something the "row"
property of my range object. Is this posible and if so what is the

corect
syntax for doing it ??

Thanks, Dan






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
Excel 97 keeps changing dimensions of autoshape rectangle Roman Excel Discussion (Misc queries) 0 March 17th 10 04:38 PM
Inserting blanks or changing dimensions Jones Excel Worksheet Functions 1 June 6th 06 01:50 PM
Properties of QueryTable Object Shilps Excel Programming 0 April 1st 04 11:31 AM
OLE Object -TexBox Properties SSR[_2_] Excel Programming 2 December 31st 03 08:22 AM
iterating through all properties of an object Barney Fife Excel Programming 4 August 22nd 03 03:18 AM


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