PC Review


Reply
 
 
Dave Ramage
Guest
Posts: n/a
 
      28th Jul 2003
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.
>-----Original Message-----
>I have searched this newsgroup and managed to come up

with
>the following code to define a dynamic range for the
>autofill function
>
>Range("B2:B31").Select
>
>Range(Selection, Selection.End(xlDown)).Select
>
>
>a = ActiveSheet.Cells(Rows.Count, 10).End(xlUp).Row
>DestRange = "C2:" & "J" & a
>
>
>Selection.AutoFill Destination:=(DestRange),
>Type:=xlFillDefault
>
>When I run this I get an error Autofill method of range
>class failed.
>The actual destination range that is produced is exactly
>the same as what I would type in ie.
>
>'Selection.AutoFill Destination:=Range("B2:J64"),
>Type:=xlFillDefault
>
>Can anyone explain why this does not work?
>
>Thanks
>
>Jacqui
>.
>

 
Reply With Quote
 
 
 
 
Jacqui Hurst
Guest
Posts: n/a
 
      29th Jul 2003
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.
>>-----Original Message-----
>>I have searched this newsgroup and managed to come up

>with
>>the following code to define a dynamic range for the
>>autofill function
>>
>>Range("B2:B31").Select
>>
>>Range(Selection, Selection.End(xlDown)).Select
>>
>>
>>a = ActiveSheet.Cells(Rows.Count, 10).End(xlUp).Row
>>DestRange = "C2:" & "J" & a
>>
>>
>>Selection.AutoFill Destination:=(DestRange),
>>Type:=xlFillDefault
>>
>>When I run this I get an error Autofill method of range
>>class failed.
>>The actual destination range that is produced is exactly
>>the same as what I would type in ie.
>>
>>'Selection.AutoFill Destination:=Range("B2:J64"),
>>Type:=xlFillDefault
>>
>>Can anyone explain why this does not work?
>>
>>Thanks
>>
>>Jacqui
>>.
>>

>.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook AutoFill Delete one autofill entry only katr52@yahoo.com Microsoft Outlook Discussion 4 5th Oct 2006 10:37 PM
autofill yabaday Microsoft Excel Discussion 2 5th Jul 2005 02:04 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Microsoft Excel Misc 1 17th Jun 2005 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George Microsoft Excel Programming 5 7th Aug 2004 10:33 AM
autofill? robz Microsoft Excel Discussion 5 4th Aug 2004 11:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:13 AM.