Hi,
The following statement seems to work in the immediate window but not as a part of a macro attached to a command button.
Range("P9:AA" & Range("length").Value + 7).FillDown
Any idea what is wrong with it?
Thanks.
Greg
Hi,
The following statement seems to work in the immediate window but not as a part of a macro attached to a command button.
Range("P9:AA" & Range("length").Value + 7).FillDown
Any idea what is wrong with it?
Thanks.
Greg
Still getting FillDown of Range class failed error.
I am using Xl97 on NT.
Thanks.
Hmmm. I'm using Xl97 on NT. I created a new workbook, defined a cell as length and put a number in it. I put some data in P9:AA9. I then pasted your one liner into a new macro and ran it. Data filled down OK. Can you attach your problem workbook?
One solution to your problem.
An example: Say you have data/formula in cells P1 to AA1 and you want to fill downwards to the last cell. Then
a = Range("A65536").End(xlUp).Row ''(Assuming column A has a full length of data)
Range("P1:AA1").Select
Selection.AutoFill Destination:=Range("P1:AA" & a)
This should solve your problem.
BOB.
Derk,
Thank you for looking into this, your majesty
I tried to upload the sample file.
The formulas in P9 - AA9 are errors but it should not matter for fill down.
Thanks again.
Greg
Weird. I experienced the same problem. Apparently there is something about filldown being invoked by a command button that doesn't work. I even modified the commandButton1_Click to call a sub in a general module to fdo the fill down. Same error. If you attach the macro (from a general module now) to a Form's button, all runs as expected. I guess that is what you will need to do.
I leave it to more knowledgable folk to explain this apparent anomoly.
At least I know now that it is some bug and will look for a workaround.
Thanks for taking your time, Derk.
Hi guys, sounds like the xl97 TakeFocusOnClick bug.
Try setting the TakeFocusOnClick Property to False of your CommandButton.
Or use Activecell.Activate as the 1st line in the code.
Wow, it was indeed. There is actually an article in knowledgebase (# 177527 )
http://support.microsoft.com/d…n-us;177527&Product=xlw97
Insomniac, thanks so much!
Greg
Yes, that was the problem! Again, I learned something new from the OzGrid forum. (Now if I could only remember them all.)
Don’t have an account yet? Register yourself now and be a part of our community!