Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill column macro that stops
I have a speadsheet that has data in column A
I want to have a macro that takes the header from B1 and fills the rest of column B until the end of data in column A I currently use this code but it fills too far and I get an error when I then try and import the file into another application. Dim X As Range Set X = ActiveSheet.[B1] X.AutoFill Destination:=X.Resize(X.End(xlDown).Row, 1) Range("B1:B10").Select So in persudo code I suppose its like this while A != empty fill B else end |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill column macro that stops
Just use column A for the row size...
'----------------------------------- Sub FillTheColumn() Dim X As Range Dim XX As Range Set XX = ActiveSheet.Range("A1") Set X = ActiveSheet.[B1] X.AutoFill Destination:=X.Resize(XX.End(xlDown).Row, 1) Range("B1:B10").Select Set X = Nothing Set XX = Nothing End Sub '----------------------------------- Regards, Jim Cone San Francisco, CA "DireWolf" wrote in message ... I have a speadsheet that has data in column A I want to have a macro that takes the header from B1 and fills the rest of column B until the end of data in column A I currently use this code but it fills too far and I get an error when I then try and import the file into another application. Dim X As Range Set X = ActiveSheet.[B1] X.AutoFill Destination:=X.Resize(X.End(xlDown).Row, 1) Range("B1:B10").Select So in persudo code I suppose its like this while A != empty fill B else end |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill column macro that stops
Thanks Jim, worked a treat.
:) On Wed, 31 Dec 2003 21:44:49 -0800, "Jim Cone" wrote: Just use column A for the row size... '----------------------------------- Sub FillTheColumn() Dim X As Range Dim XX As Range Set XX = ActiveSheet.Range("A1") Set X = ActiveSheet.[B1] X.AutoFill Destination:=X.Resize(XX.End(xlDown).Row, 1) Range("B1:B10").Select Set X = Nothing Set XX = Nothing End Sub '----------------------------------- Regards, Jim Cone San Francisco, CA "DireWolf" wrote in message ... I have a speadsheet that has data in column A I want to have a macro that takes the header from B1 and fills the rest of column B until the end of data in column A I currently use this code but it fills too far and I get an error when I then try and import the file into another application. Dim X As Range Set X = ActiveSheet.[B1] X.AutoFill Destination:=X.Resize(X.End(xlDown).Row, 1) Range("B1:B10").Select So in persudo code I suppose its like this while A != empty fill B else end |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Opening a file stops a Macro | Excel Worksheet Functions | |||
Macro stops at random places. | Excel Discussion (Misc queries) | |||
Auto fill drop down stops at second cell | Excel Discussion (Misc queries) | |||
Macro repeats and then stops | Excel Discussion (Misc queries) | |||
Macro stops when another workbook is open | Excel Programming |