Avoiding the worksheet specific name in a macro

J

Jim Thomlinson

If Activesheet is use in place of Sheets("Sheet1") then your code will
operate on the active sheet. If the code is in a standard code module and the
reference to a sheet is omitted then the code will operate on the active
sheet by default. If you would like to post your code we can give you a hand
making it generic.
 
D

Dave Peterson

Without knowing what your code looks like, maybe you can just refer to the
activesheet instead of referring to a sheet by its name:

With activesheet
.range("A1").value = "hi there"
.range("x9:z99").clearcontents
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top