LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Excel VBA setting Ranges

I would like to change the first Cell and the last Cell of a Range using
VBA

I have this code;

Dim MyRange As Range
Set MyRange = Selection

lets say the selection was ($A$1:$H$3), so I now have a MyRange of $A$1:$H
$3 and using;

MsgBox "My Range is " & MyRange.Address

I get a message that says that this is true.

Now I want to change the first Cell ($A$1) or the last Cell ($H$3) to
something different so I have tried these variations;

MyRange = Range(MyRange(1, 1).Address, H13) - Also tried using 'Set'
Set MyRange = Range("H3", "K8")

but using the message after either of these lines shows that the original
range limit is still applying.

Can anyone tell me how to set the first or last cell properties using VBA ?

Any help appreciated

Thanks
 
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
Setting Scope of name ranges to particular worksheet AZSteve Excel Discussion (Misc queries) 2 May 1st 10 01:13 PM
dynamic setting of data ranges Patrick Charts and Charting in Excel 1 January 7th 08 08:51 AM
help with setting up dynamic name ranges Jeff Excel Worksheet Functions 5 September 22nd 06 02:07 PM
Setting ranges Scottie[_2_] Excel Programming 3 February 26th 04 06:22 PM
Setting PrintArea by using Named Ranges Oren Klaber Excel Programming 2 January 30th 04 10:34 PM


All times are GMT +1. The time now is 01:46 AM.

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

About Us

"It's about Microsoft Excel"