AutoFill

D

Dave Ramage

Jacqui,

DestRange = "C2:" & "J" & a
This line sets the variant variable DestRange to "B2:J64" -
this is a string. The Autofill method requires a Range
Object for the destination parameter, so you get an error.

The solution is to add a Range(...) property statement
around the text to turn the text into a range object like
this:
Selection.AutoFill Destination:=Range(DestRange),
Type:=xlFillDefault

Cheers,
Dave.
 
J

Jacqui Hurst

Cheers, saved my sanity :)

-----Original Message-----
Jacqui,

DestRange = "C2:" & "J" & a
This line sets the variant variable DestRange to "B2:J64" -
this is a string. The Autofill method requires a Range
Object for the destination parameter, so you get an error.

The solution is to add a Range(...) property statement
around the text to turn the text into a range object like
this:
Selection.AutoFill Destination:=Range(DestRange),
Type:=xlFillDefault

Cheers,
Dave.
.
 

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