Mac – Excel macros how to autofill cells

auto-form-fillmacrosmicrosoft excel

Hi i am not familiar with VBA code but i know java. I am looking to create a macro that checks if a cell is not blank and autofill the cells in another column but in the same row with the formula above them. Any ideas??

    975   805040   2065bc210    325647998522
    976   802030   2089bc212    325647956721
    977                        *325647964751*
    978                        *325647967866*
    979                        *325647964452*

Sorry for the lack of details. This is an example of my excel the left are the numbers of rows i need to autofill the other collumns when i add manually the numbers in stars. The other columns get their information from a formula. I cann't post a pic because my reputation is low.

Something like that but didn't worked

Sub CheckCell()
    Dim i As Integer
       i = 3

     Do
      Selection.AutoFill Destination:=Range("Ai:A(i+1)"), Type:=xlFillDefault  
     i = i+1
    Loop While (ActiveSheet.Range("Bi").Value != "")
 End Sub

Best Answer

This can be done in a couple ways;
(These examples assume cell to check is A2 and the autofill text is to go into B2. Adjust accordingly)

With a formula (placed in the cell you want the autofill text)

=IF(ISBLANK(A2),"autofill text","")

With VBA

Sub CheckCell()

    If ActiveSheet.Range("A2").Value = "" Then
        ActiveSheet.Range("B2").Value = "Autofill"
    End If

End Sub

NOTE: These examples are very basic and vague because you did not provide a lot of details in your question.

Related Question