Hi
I have some modified code to check User entry into a varying number of cells and call up a MsgBox if any are empty.
I must have the placement of the what to do line if condition not met in the wrong place as whilst the code catches the missing entries once warned it moves and calls the next sub routine.
As you will see I want the code to stop and return user to P12 which is the general area of where these cells are located.
Hopefully this is a simple fix and just me being dense.
Many thanks
![]()
Private Sub cmdCarePaste_Click() Dim i As Integer Dim r As Range i = Sheets("CareTbl28Calx").cbWsPeriodCount.Value + 11 Set r = Range("P12:P" & i) For Each cell In r If Not IsNumeric(cell) Or cell.Value = vbNullString Then MsgBox ("Certain periods have no annual care amounts entered"), vbCritical, "Annual amount warning" Sheets("CareTbl28Calx").Range("P12").Activate Exit Sub Cancel = True Exit For End If Next Call CareTbl28CalxcompPaste_NextEmptyRow ' and so on











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks