Who wants to help me with a cute VBA problem?

The macro below finds the first empty row and inserts data into it, however I need to find the first two empty rows, and then enter data into the next row (or find the first three empty rows I suppose).

Macro1()
Range(“A” & Rows.Count).End(x1Up).Offset(1).Select
ActiveCell.Value = “Hello Friend”
End Sub

What do I do?

Computer says no, mate.

It doesn’t even say that

You need to have brackets around Range and Select as well

No I don’t

Just move on with your life.

5 Likes

i’ve seen cuter

1 Like

No it doesn’t. At best, it will find the last row with a value in column A and write a value in the cell below that.

It isnt pretty but this works

Sub Macro1()

’ Macro1 Macro

Dim LastRow As Long

LastRow = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

'Put your start point instead of A2
Range(“A2”).Select

 Do Until ActiveCell.Row = LastRow

If ActiveCell.Value = "" And ActiveCell.Offset(1, 0).Value = "" And ActiveCell.Offset(2, 0).Value = "" Then
ActiveCell.Offset(2, 0).Value = "Your Text Here"
        
Else
ActiveCell.Offset(1, 0).Select
End If    

Loop

End Sub

This will start in A2 and loop down until your last row of data.

This just seems to select the last row with data in rather than inserting text a couple rows below it. I’ll try and use it as a base though. Thanks!

careful what you ask for :sweat_smile: