Thread: Fill Down Macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Lost in excel Lost in excel is offline
external usenet poster
 
Posts: 29
Default Fill Down Macro

I'm sorry - can you put the specific formula in one section. This one is not
working. Where is the beginning and the end? I'm confused...

"Don Guillett" wrote:

Bottom = [D9].End(xlDown).Row

with Range("a9", Range("a9").SpecialCells(xlLastCell))
.Sort Key1:=Range("D9"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
.NumberFormat = "General"
end with

Range("D9").AutoFill Destination:=Range("D9:D & Bottom")
'why copy and then change??
Range("D9:D" & Bottom).FormulaR1C1 = "=RC[3]-RC[1]"


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lost in Excel" wrote in message
...
I am working to create a Macro that will look at a specific column and fill
down a formula. The Macro is working properly to identify the column, but
it
is not working properly at the end due to an error. My formula is
Bottom = [D9].End(xlDown).Row
Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("D9"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Selection.NumberFormat = "General"
Range("D9").Select
Selection.AutoFill Destination:=Range("D9:D & Bottom").Select (ERROR
HERE)
Range("D9:D" & Bottom).Select
ActiveCell.FormulaR1C1 = "=RC[3]-RC[1]"

The error is indicated above. Does anyone know why this formula won't
fill
down the column? I only need it is fill in where there is data. Thanks!