Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Autofill to the left of data

Hi

I often use autofill in the last column of data. Now I'm trying to Autofill
column A, and the code I use just autofills to the end of the spreadsheet. I
suspect this is because I'm trying to autofill when the data is to the right
of my column rather than the left. I've pasted the two bits of code that do
the same thing and normally work for me below.

Can someone advise what I need to change to make this work?

Dim LastRow As Long
With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Range("T4").AutoFill Destination:=.Range("T4:T" & LastRow),
Type:=xlFillDefault
End With

Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" &
ActiveSheet.UsedRange.Rows.Count)

Thanks in advance for any suggestions.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Autofill to the left of data

If you want to autofill column a to the last row with data in column B
then use this

With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "B").End(xlUp).Row
Range("A4").AutoFill Destination:=.Range("A4:A" & LastRow), Type:=xlFillDefault
End With


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AnitaML" wrote in message ...
Hi

I often use autofill in the last column of data. Now I'm trying to Autofill
column A, and the code I use just autofills to the end of the spreadsheet. I
suspect this is because I'm trying to autofill when the data is to the right
of my column rather than the left. I've pasted the two bits of code that do
the same thing and normally work for me below.

Can someone advise what I need to change to make this work?

Dim LastRow As Long
With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Range("T4").AutoFill Destination:=.Range("T4:T" & LastRow),
Type:=xlFillDefault
End With

Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" &
ActiveSheet.UsedRange.Rows.Count)

Thanks in advance for any suggestions.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Autofill to the left of data

I see i miss a dot before

Range("A4")...........................

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
If you want to autofill column a to the last row with data in column B
then use this

With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "B").End(xlUp).Row
Range("A4").AutoFill Destination:=.Range("A4:A" & LastRow), Type:=xlFillDefault
End With


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AnitaML" wrote in message ...
Hi

I often use autofill in the last column of data. Now I'm trying to Autofill
column A, and the code I use just autofills to the end of the spreadsheet. I
suspect this is because I'm trying to autofill when the data is to the right
of my column rather than the left. I've pasted the two bits of code that do
the same thing and normally work for me below.

Can someone advise what I need to change to make this work?

Dim LastRow As Long
With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Range("T4").AutoFill Destination:=.Range("T4:T" & LastRow),
Type:=xlFillDefault
End With

Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" &
ActiveSheet.UsedRange.Rows.Count)

Thanks in advance for any suggestions.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Autofill to the left of data

Thanks very much - worked a treat

"Ron de Bruin" wrote:

I see i miss a dot before

Range("A4")...........................

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
If you want to autofill column a to the last row with data in column B
then use this

With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "B").End(xlUp).Row
Range("A4").AutoFill Destination:=.Range("A4:A" & LastRow), Type:=xlFillDefault
End With


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AnitaML" wrote in message ...
Hi

I often use autofill in the last column of data. Now I'm trying to Autofill
column A, and the code I use just autofills to the end of the spreadsheet. I
suspect this is because I'm trying to autofill when the data is to the right
of my column rather than the left. I've pasted the two bits of code that do
the same thing and normally work for me below.

Can someone advise what I need to change to make this work?

Dim LastRow As Long
With Worksheets("CURRENT WEEK")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Range("T4").AutoFill Destination:=.Range("T4:T" & LastRow),
Type:=xlFillDefault
End With

Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" &
ActiveSheet.UsedRange.Rows.Count)

Thanks in advance for any suggestions.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofill data in cell with other existing data. Steen Lautrup Excel Discussion (Misc queries) 1 June 3rd 08 12:25 PM
Autofill Down When Text to Left is Not Blank ryguy7272 Excel Worksheet Functions 2 September 20th 07 06:18 AM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
Macro that will autofill a column with data, up to the last row of data in previous c Max Velocity Excel Programming 4 November 27th 03 10:34 AM


All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"