• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Determine if the Cell next to the next open cell is blank

Petar Willhite

New Member
Hello all I am stuck and tying to figure out how to fix the code below. Basically the code finds the next available Cell in Column B then pastes certain text there. But I need to add an If statement that stop the Macro and alert the user if the Cell to the left is blank.

Thanks for the help!

Code:
If IsEmpty(Range("A" & Rows.Count).End(xlToLeft).Value) = True Then
    Sheets("Sheet1").Select
    Range("B" & Rows.Count).End(xlUp).Offset(1).Select
    ActiveCell.FormulaR1C1 = "AAA"
    Sheets("Sheet1").Select
    Range("B20").Select
    Else
    MsgBox "System Code is empty is empty"
    End If
 
Last edited by a moderator:
Hi:
Since you have not uploaded the workbook. I have coded it as per my understanding.

Code:
Dim i As Long
i = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row + 1
If Not IsEmpty(Range("A" & i).Value) = True Then
Range("B" & i).FormulaR1C1 = "AAA"
Else
MsgBox "System Code is empty"
End If

Thanks
 
Hi:
Since you have not uploaded the workbook. I have coded it as per my understanding.

Code:
Dim i As Long
i = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row + 1
If Not IsEmpty(Range("A" & i).Value) = True Then
Range("B" & i).FormulaR1C1 = "AAA"
Else
MsgBox "System Code is empty"
End If

Thanks

That worked perfectly thank you! Sorry I forgot to upload the file.
 
Back
Top