autofill range class failure

S

Susan

i'm working on a larger macro & am having trouble w/this section
specifically. i've got it almost done but am getting a "run-time error
1004... autofill method of Range class failed" error........

Startcell.AutoFill Destination:=InsRngTmp, Type:=xlFillDefault

is there something wrong with this line? this is where it keeps
breaking.
"startcell" is the cell where the formula is entered, & then it's
supposed to autofill into "insrngtmp".

Dim Startcell As Range
Dim InsRngTmp As Range
Set InsRngTmp = Worksheets("xx").Range("d7:d100")
Set Startcell = Worksheets("xx").Range("d6")

any ideas would be appreciated.
thanks
susan (banging her head against the monitor)
 
J

Jim Cone

Susan( bhhatm)
The destination range must include the start range.
So change the destination range to include D6.
However, in most case you need at least two cells (values) in order to
autofill a range... maybe D5:D6 for the start range and D5:D100
for the destination range?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

i'm working on a larger macro & am having trouble w/this section
specifically. i've got it almost done but am getting a "run-time error
1004... autofill method of Range class failed" error........

Startcell.AutoFill Destination:=InsRngTmp, Type:=xlFillDefault

is there something wrong with this line? this is where it keeps
breaking.
"startcell" is the cell where the formula is entered, & then it's
supposed to autofill into "insrngtmp".

Dim Startcell As Range
Dim InsRngTmp As Range
Set InsRngTmp = Worksheets("xx").Range("d7:d100")
Set Startcell = Worksheets("xx").Range("d6")

any ideas would be appreciated.
thanks
susan (banging her head against the monitor)
 
G

Guest

Set InsRngTmp = Worksheets("xx").Range("d7:d100")
should be

Set InsRngTmp = Worksheets("xx").Range("d6:d100")

the destination should include the original cell(s)
 
S

Susan

tom & jim:
i originally had it as including the starting cell, but when it
wouldn't work i figured that the starting cell couldn't be in the
range. that's why i changed it. but i think having the startcell be a
2-cell range made it work.
thank you!

now, while i have you, tom was trying to teach me to combine
commands.......
can you tell me why this works:
InsRange1.Copy
InsRange2.PasteSpecial Paste:=xlPasteAll

but this doesn't???
InsRange1.Copy("InsRange2").PasteSpecial Paste:=xlPasteAll

what am i doing wrong here? it gives me an error "unable to get the
copy property of the range class."
thanks
susan (gratefully feeling much better now!)
 
G

Guest

Susan,

Reference a post in some other thread which I have lost track of, but
stumbled on your post outside the thread, if you want me to look at
something, send it to me directly

(e-mail address removed)
 

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