Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default make range available to another macro

I have a procedure which sets a range to a variable:
Set copyrng = Range(HotStringStart, HotStringEnd)

The procedure then calls a separate macro, but the macro doesn't
recognize the range.

The range is available to the procedure it resides in but not to the
called macro. I am using the Public statement at the beginning of the
procedure

How can I allow copyrng to be used in the called macro. I am trying to
copy each cell in copyrng and write it to a text file.

Thanks...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default make range available to another macro

Hi
Put the public declaration at the top of the code module

Public copyrng as Range

sub macro1()
'''
end sub

sub macro2()
'''end sub

etc

if both subs are in the same code module you can use Dim rather than
public too, but it still goes at the top of the module outside the
procedures.

regards
Paul


On Jun 18, 9:36*pm, Steve wrote:
I have a procedure which sets a range to a variable:
Set copyrng = Range(HotStringStart, HotStringEnd)

The procedure then calls a separate macro, but the macro doesn't
recognize the range.

The range is available to the procedure it resides in but not to the
called macro. I am using the Public statement at the beginning of the
procedure

How can I allow copyrng to be used in the called macro. I am trying to
copy each cell in copyrng and write it to a text file.

Thanks...


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default make range available to another macro


Thanks for the help, Paul.
Works good now...

---
Steve

On Jun 19, 5:10*am, wrote:
Hi
Put the public declaration at the top of the code module

Public copyrng as Range

sub macro1()
'''
end sub

sub macro2()
'''end sub

etc

if both subs are in the same code module you can use Dim rather than
public too, but it still goes at the top of the module outside the
procedures.

regards
Paul

On Jun 18, 9:36*pm, Steve wrote:

I have a procedure which sets a range to a variable:
Set copyrng = Range(HotStringStart, HotStringEnd)


The procedure then calls a separate macro, but the macro doesn't
recognize the range.


The range is available to the procedure it resides in but not to the
called macro. I am using the Public statement at the beginning of the
procedure


How can I allow copyrng to be used in the called macro. I am trying to
copy each cell in copyrng and write it to a text file.


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 to make a dynamic named range Arup C[_2_] Excel Discussion (Misc queries) 4 December 31st 07 12:17 PM
Can you make a range absolute? Danielle Excel Discussion (Misc queries) 3 November 28th 07 11:08 PM
Make Variable Range in VBA Jholerjo Excel Programming 6 November 3rd 07 02:06 PM
make two range exclusive clara Excel Programming 1 May 2nd 07 09:12 PM
Need to make a "range" in conditional formatting. DocMartigan Excel Discussion (Misc queries) 3 October 7th 05 04:19 AM


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