Avoiding the worksheet specific name in a macro

  • Thread starter Thread starter Jeff Modares
  • Start date Start date
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.
 
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
 
Back
Top