willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 929
- Office Version
- 365
- Platform
- Windows
Hello,
I have the below code and I am still very new to vba, but I cannot see where I went wrong...I get a mismatch error on the first line. What I am trying to write is if there are any blank cells between A2 and J2 that it will prompt the msg box and end the macro and not proceed to updating the Batch Log spreadsheet. I hope someone can shed some light on the error.
Thank you
Code:
If ThisWorkbook.Sheets("New BL Data").Range("A2:J2").Value = "" Then
MsgBox "Please Complete all Fields"
Exit Sub
End If
Range("A2:I2").Select
Selection.Copy
Sheets("Batch Log").Select
Range("BLTable").Cells(1, 1).End(xlDown).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("New BL Data").Select
Range("A1").Select
'
End Sub
I have the below code and I am still very new to vba, but I cannot see where I went wrong...I get a mismatch error on the first line. What I am trying to write is if there are any blank cells between A2 and J2 that it will prompt the msg box and end the macro and not proceed to updating the Batch Log spreadsheet. I hope someone can shed some light on the error.
Thank you
Code:
If ThisWorkbook.Sheets("New BL Data").Range("A2:J2").Value = "" Then
MsgBox "Please Complete all Fields"
Exit Sub
End If
Range("A2:I2").Select
Selection.Copy
Sheets("Batch Log").Select
Range("BLTable").Cells(1, 1).End(xlDown).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("New BL Data").Select
Range("A1").Select
'
End Sub