Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a number of macros in excel. One of them uses a function that
i would like to fill down a column for as many rows as there are in the worksheet (which will vary from time to time). I was wondering if anyone might have a suggestion how to code this. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Chaz, Try this...
Sub Autofill_Range() Dim LastRow As Long Dim LastCol As Long Dim rng As Range With ActiveSheet Set rng = .UsedRange 'try to reset lastused cell With rng LastRow = .Rows(.Rows.Count).Row LastCol = .Columns(.Columns.Count).Column End With ' Change F1 to whatever your last column is .Range("F1").AutoFill _ Destination:=.Range("F1:F" & LastRow), Type:=xlFillDefault ' Change th above to whatever last column you have Like Y:Y End With ' End Sub "Chaz" wrote: I have created a number of macros in excel. One of them uses a function that i would like to fill down a column for as many rows as there are in the worksheet (which will vary from time to time). I was wondering if anyone might have a suggestion how to code this. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Im assuming you mean that the number of rows varies, as to how many rows
contain information correct? If thats true then this will work Range("Where ever your info starts here").Select Range(Selection, Selection.End(xlDown)).Select ActiveCell.Formula = "whatever you want to fill down" Selection.FillDown the only catch to this, is if there are blank bits of data somewhere, it will stop at those instead. "Chaz" wrote: I have created a number of macros in excel. One of them uses a function that i would like to fill down a column for as many rows as there are in the worksheet (which will vary from time to time). I was wondering if anyone might have a suggestion how to code this. Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Beyond the macro recorder (specifically, example 4)
http://www.tushar- mehta.com/excel/vba/beyond_the_macro_recorder/index.htm -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... I have created a number of macros in excel. One of them uses a function that i would like to fill down a column for as many rows as there are in the worksheet (which will vary from time to time). I was wondering if anyone might have a suggestion how to code this. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Fill function | New Users to Excel | |||
Fill function | Excel Worksheet Functions | |||
Fill Function to next Column | Excel Worksheet Functions | |||
excel modular sheets subsheets | Excel Discussion (Misc queries) | |||
I have a list of data, fill in the gaps. FILL function won't work | Excel Discussion (Misc queries) |