View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chandlm chandlm is offline
external usenet poster
 
Posts: 1
Default Macro, autofill formula to end of column

Monica,

Try amending the code to read :-


CNT = Range("B1", Range("B1").End(xlDown)).Count
Debug.Print CNT

Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
ActiveCell.FormulaR1C1 = "run"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=RC[1]"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]<R[-1]C[1]+3,R[-1]C,RC[1])"
Range("A3").Select
Selection.NumberFormat = "m/d/yy h:mm"
Selection.AutoFill Destination:=Range("A3", "a" & CNT)
Type:=xlFillDefault
Range("A3", "A" & CNT).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:=False, Transpose:=False




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