Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Late night I guess - makeing a new range from an old rangename

Hi;

I have a range name $B$5:$B$?. ? means the length of the range can change.
I want to create a new temporary range that depends on the length of the
original range name i.e. $A$5:$A$?. I should know how to do this, but
tonight, Gawd if I can make it work.

Any suggestions?

Regards Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Late night I guess - makeing a new range from an old rangename

Where YourRange refers to A5:A?, try
=OFFSET(Sheet1!$B$5,0,0,ROWS(YourRange),1)
or
=OFFSET(YourRange,0,1)
or, programmatically
Range("YourRange").Offset(0, 1)




"Bill Case" wrote:

Hi;

I have a range name $B$5:$B$?. ? means the length of the range can change.
I want to create a new temporary range that depends on the length of the
original range name i.e. $A$5:$A$?. I should know how to do this, but
tonight, Gawd if I can make it work.

Any suggestions?

Regards Bill

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Late night I guess - makeing a new range from an old rangename

My explanation in my first post wasn't very clear. Let me try again.

I have RangeName as $B$5:$B$?

I want to :

Dim ARange as Range
Set ARange = RangeName only as $A$5:$A$?

I can do this with Cells( i, 0) and a For loop but there should be a better
way.

Regards Bill


"Bill Case" wrote:

Hi;

I have a range name $B$5:$B$?. ? means the length of the range can change.
I want to create a new temporary range that depends on the length of the
original range name i.e. $A$5:$A$?. I should know how to do this, but
tonight, Gawd if I can make it work.

Any suggestions?

Regards Bill

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Late night I guess - makeing a new range from an old rangename


Dim orgRange As Range
Dim newRange As Range
Dim newString As String

Set orgRange = ActiveSheet.Range("$B$5:$B$45")
newString = Replace(orgRange.Address, "B", "A", 1, -1, vbBinaryCompare)
Set newRange = ActiveSheet.Range(newString)




"Bill Case" schreef in bericht
...
My explanation in my first post wasn't very clear. Let me try again.

I have RangeName as $B$5:$B$?

I want to :

Dim ARange as Range
Set ARange = RangeName only as $A$5:$A$?

I can do this with Cells( i, 0) and a For loop but there should be a
better
way.

Regards Bill


"Bill Case" wrote:

Hi;

I have a range name $B$5:$B$?. ? means the length of the range can
change.
I want to create a new temporary range that depends on the length of the
original range name i.e. $A$5:$A$?. I should know how to do this, but
tonight, Gawd if I can make it work.

Any suggestions?

Regards Bill



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Late night I guess - makeing a new range from an old rangename

Hi JMB;

Pushing 'Yes' for "Was this post helpful to you?" seems inadequate. It's
late here; I promised I would be finished my little project by the end of the
weekend; can't think anymore. I really appreciate your help.

Regards Bill




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Late night I guess - makeing a new range from an old rangename

set ARange = RangeName.offset(0,-1)

--
Regards,
Tom Ogilvy


"Bill Case" wrote in message
...
My explanation in my first post wasn't very clear. Let me try again.

I have RangeName as $B$5:$B$?

I want to :

Dim ARange as Range
Set ARange = RangeName only as $A$5:$A$?

I can do this with Cells( i, 0) and a For loop but there should be a
better
way.

Regards Bill


"Bill Case" wrote:

Hi;

I have a range name $B$5:$B$?. ? means the length of the range can
change.
I want to create a new temporary range that depends on the length of the
original range name i.e. $A$5:$A$?. I should know how to do this, but
tonight, Gawd if I can make it work.

Any suggestions?

Regards Bill



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
Figuring Late night Hours WIgirl Excel Discussion (Misc queries) 2 June 3rd 09 07:23 AM
Makeing a Spreadsheet Dottie Excel Discussion (Misc queries) 2 July 7th 06 11:03 PM
Makeing People Save As Eric Excel Discussion (Misc queries) 6 August 17th 05 10:53 PM
ActiveWorkbook.Protect password:=range("rangename") does not work WimR Excel Programming 2 June 26th 05 08:47 AM
ActiveWorkbook.Protect password:=range("rangename") does not work WimR Excel Discussion (Misc queries) 1 June 26th 05 08:47 AM


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