vendredi 2 janvier 2015

VBA Excel - How to auto-fill a cell with specific value in a cell

I am trying to create a VBA Macro for a workbook that starts off as a template. The initial template requires that a formula be auto-filled down to calculate all of the rows. If the results are all zero then the macro will automatically delete the entire column. The issue arises when the macro is run again and the first column NO LONGER needs to be autofilled. The new column contains dates and the macro will automatically fill the dates down, which we do not want. I tried an IF statement but it continues to autofill?


Range("A4").Select



If Sheets("Template").Range("A3").Value = "TEST" Then
Selection.AutoFill Destination:=Range("A4:A5000")


My goal is to have the autofill performed only if the cell A4 contains the text: TEST. Is this possible?


Thanks in advance for your help!


Aucun commentaire:

Enregistrer un commentaire