How to declare an Active Worksheet in a variable?

unikitty94 picture unikitty94 · May 26, 2015 · Viewed 69.3k times · Source

I'm trying to keep a variable to the currently open worksheet in VBA. So far I have

 Dim Active As Worksheet
 Set Active = ActiveWorksheet 

For some reason it gives me an error in the last line, saying Object required. My code opens a new worksheet with the data in the Active sheet, so I need a variable to hold my place in the currently active worksheet. Any idea why this isn't working correctly?

Answer

Sobigen picture Sobigen · May 26, 2015

You need to use ActiveSheet instead of ActiveWorksheet