hi mdshotgun. i've got to put a disclaimer first as i'm not into VBA. but it seems like you should put your error msg within your IF statement like this:
Option Explicit
Private Sub CommandButton1_Click()
Range("A2").ClearContents
Range("d10:e13").Select
If Range("h15").Value > 19 Then
GoTo err1
err1: MsgBox ("Text is too long")
End If
With Selection
.Copy
End With
Call PasteSelect
Application.CutCopyMode = False
End Sub
otherwise, your codes skip the "GoTo err1" because H15 is not more than 19. then it runs the whole code until "err1: MsgBox ("Text is too long")" & runs it anyway. coloured the code i cut red
Bookmarks