Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto Filling a column

I have a column with data B2:B8785. The next column C, has a formual i
the first row (C2). I want to drag C2 down until it populates to th
same max row as column B (8785). If I double click on the bottom righ
corder of C2 and record this in VBA I get:

Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C8785")
Range("C2:C8785").Select

Note that VBA goes immeditealy to C8575. But what if the row in colum
B is variable? How do I code this so that the autofill for C2 fills t
the max row of column B?

Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Auto Filling a column

Try this then

Sub test()
Dim Lrow As Long
Lrow = Range("B" & Rows.Count).End(xlUp).Row
Range("C2").AutoFill Destination:=Range("C2:C" & Lrow)
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"ExcelMonkey " wrote in message ...
I have a column with data B2:B8785. The next column C, has a formual in
the first row (C2). I want to drag C2 down until it populates to the
same max row as column B (8785). If I double click on the bottom right
corder of C2 and record this in VBA I get:

Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C8785")
Range("C2:C8785").Select

Note that VBA goes immeditealy to C8575. But what if the row in column
B is variable? How do I code this so that the autofill for C2 fills to
the max row of column B?

Thanks


---
Message posted from http://www.ExcelForum.com/



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
Auto filling cells in a column Alex Excel Discussion (Misc queries) 7 October 16th 07 02:46 PM
Auto Filling ckane Excel Worksheet Functions 1 May 3rd 07 09:48 PM
Auto filling a row phil2006 Excel Discussion (Misc queries) 2 July 31st 06 12:33 PM
Auto FILLING/UPDATE Sonnnn New Users to Excel 1 November 3rd 05 09:04 PM
Auto Protecting cells & auto filling date ccarmock Excel Discussion (Misc queries) 7 September 30th 05 09:21 PM


All times are GMT +1. The time now is 04:42 PM.

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"