calling Autofill function in excel

Oleg

Registered User.
Local time
Today, 12:20
Joined
Jun 6, 2011
Messages
14
I am getting total number of rows, and now trying to auofill for this number in excel spreadseet that is currently open

for some reasons some times it works, other doesn't.
is there an issue with the tab staying active ?


Code:
    'expand the formula
    objActiveWkb.Worksheets("YTD").Select
    Range("X2").Select
    X = "X2:X" & TotalRows
    Selection.AutoFill Destination:=Range(X)
 
I dont really have an answer for you as I have not had this problem. But my suggestion or what I would do if I had this problem is to instead of using SELECTION I would try to get the range as a range and then call the autofill.
 
you mean

Range(Y).Selection.AutoFill

? that doesn't work at all...
 
you mean

Range(Y).Selection.AutoFill

? that doesn't work at all...

I certainly don't, but I might mean something like this

Code:
Set sourceRange = Worksheets("Sheet1").Range("A1:A2")
Set fillRange = Worksheets("Sheet1").Range("A1:A20")
sourceRange.AutoFill Destination:=fillRange


When all else fails click ME and then ME.
 

Users who are viewing this thread

Back
Top Bottom