Try this code
Option Explicit
Dim eRng As Range
Dim eeRng As Range
Dim euRng As Range
Dim pwrWs As Worksheet
Private Sub cancelbutton_Click()
Unload powercheck
End Sub
Private Sub CommandButton1_Click()
Post
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End Sub
Private Sub okbutton_Click()
Post
Unload Me
End Sub
Private Sub UserForm_Initialize()
Set pwrWs = Worksheets("Power")
Set eRng = pwrWs.Range("B6:C48")
End Sub
Sub Post()
Set eeRng = pwrWs.Cells(49, 2).End(xlUp).Offset(1, 0)
If eeRng.Row > 48 Then
Select Case MsgBox("The table is full. Continue to next table?", vbYesNo Or vbQuestion Or vbDefaultButton1, "Next table")
Case vbYes
Set eeRng = pwrWs.Cells(49, 6).End(xlUp).Offset(1, 0)
If eeRng.Row > 48 Then
MsgBox "Tables are full", vbCritical, "Quitting"
GoTo exit_post
End If
Case vbNo
GoTo exit_post
End Select
End If
eeRng.Value = Me.TextBox1.Value
eeRng.Offset(, 1).Value = Me.TextBox2.Value
exit_post:
eeRng.Value = Me.TextBox1.Value
Set eeRng = Nothing
End Sub
Bookmarks