Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Old macro breaks!

I've been running a series of macros without problems for months. When
I made some major modifications to another macro in the same project,
all these macros stopped working, even though the macro I was modifying
and these macros don't call or relate to each other. The only
connection is that they use the same range and varable name for that
range.

Sub Top10()

ActiveSheet.Range("rFltrRng").AdvancedFilter
Action:=xlFilterInPlace, CriteriaRange:= _
Range("Z1:Z2"), Unique:=False
Range("a1").Select

End Sub

I've tried using a different name for "rFltrRng" to separate it from
the other variable in the other macro.
Any ideas?
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Old macro breaks!

rFltrRng isn't a variable. It is a string constant. Used in the context
you present, it represents the name of a range in Insert=Name=Define.

You need to go to Insert=Name=Define and see what the current refers to
Range definition is. If it isn't what you expect, then you need to figure
out how it is getting changed.

--
Regards,
Tom Ogilvy

"davegb" wrote in message
oups.com...
I've been running a series of macros without problems for months. When
I made some major modifications to another macro in the same project,
all these macros stopped working, even though the macro I was modifying
and these macros don't call or relate to each other. The only
connection is that they use the same range and varable name for that
range.

Sub Top10()

ActiveSheet.Range("rFltrRng").AdvancedFilter
Action:=xlFilterInPlace, CriteriaRange:= _
Range("Z1:Z2"), Unique:=False
Range("a1").Select

End Sub

I've tried using a different name for "rFltrRng" to separate it from
the other variable in the other macro.
Any ideas?
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Old macro breaks!

Do you have "Option Explicit" at the top of your macro modules?
This forces Excel to alert you when there are certain problems with your
code:
variables that are not recognized; variables not defined correctly, etc.

Please supply more info on the nature of the any errors that come up.
Type, line of code(s) that fails, etc...

--
steveB

Remove "AYN" from email to respond
"davegb" wrote in message
oups.com...
I've been running a series of macros without problems for months. When
I made some major modifications to another macro in the same project,
all these macros stopped working, even though the macro I was modifying
and these macros don't call or relate to each other. The only
connection is that they use the same range and varable name for that
range.

Sub Top10()

ActiveSheet.Range("rFltrRng").AdvancedFilter
Action:=xlFilterInPlace, CriteriaRange:= _
Range("Z1:Z2"), Unique:=False
Range("a1").Select

End Sub

I've tried using a different name for "rFltrRng" to separate it from
the other variable in the other macro.
Any ideas?
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Old macro breaks!


Thanks, Tom, that helped me track down the problem.

Tom Ogilvy wrote:
rFltrRng isn't a variable. It is a string constant. Used in the context
you present, it represents the name of a range in Insert=Name=Define.

You need to go to Insert=Name=Define and see what the current refers to
Range definition is. If it isn't what you expect, then you need to figure
out how it is getting changed.

--
Regards,
Tom Ogilvy

"davegb" wrote in message
oups.com...
I've been running a series of macros without problems for months. When
I made some major modifications to another macro in the same project,
all these macros stopped working, even though the macro I was modifying
and these macros don't call or relate to each other. The only
connection is that they use the same range and varable name for that
range.

Sub Top10()

ActiveSheet.Range("rFltrRng").AdvancedFilter
Action:=xlFilterInPlace, CriteriaRange:= _
Range("Z1:Z2"), Unique:=False
Range("a1").Select

End Sub

I've tried using a different name for "rFltrRng" to separate it from
the other variable in the other macro.
Any ideas?
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Old macro breaks!



STEVE BELL wrote:
Do you have "Option Explicit" at the top of your macro modules?


Yes

This forces Excel to alert you when there are certain problems with your
code:
variables that are not recognized; variables not defined correctly, etc.

Please supply more info on the nature of the any errors that come up.
Type, line of code(s) that fails, etc...

Thanks for the help, Steve!

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
Macro breaks my links. kimberly_churchill Excel Discussion (Misc queries) 1 September 11th 06 07:46 PM
Programming (macro) breaks due to translation RBeau Excel Discussion (Misc queries) 6 June 6th 06 09:41 PM
blank row macro with page breaks DKY[_20_] Excel Programming 5 September 28th 05 05:54 PM
blank row macro with page breaks DKY[_19_] Excel Programming 0 October 22nd 04 02:20 PM
blank row macro with page breaks DKY[_18_] Excel Programming 1 October 22nd 04 02:09 PM


All times are GMT +1. The time now is 02:51 PM.

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"