Reputation: 53
Trying to set a range variable = to current print area.
dim rng as range
Set rng = ActiveSheet.PageSetup.PrintArea
There is more to it than this, but this is where I am getting stuck, Getting a Run-time error '424': Object required
I am assuming this is because the printarea is text and the variable I am using is set as a range. How do I get my rng variable set to printarea range?
Upvotes: 3
Views: 2475
Reputation: 3585
As long as the PrintArea is already assigned a value you can turn it into a range object like this:
Dim rng As Range
'This has to be set or print area returns a blank string
'which will cause the set statement below to throw an error
ActiveSheet.PageSetup.PrintArea = "A1:B1"
Set rng = Range(ActiveSheet.PageSetup.PrintArea)
Upvotes: 3