Sub test Dim XR As Long XR = Range("D" & Rows.Count).End(xlUp).row Carryon= MsgBox("Do totals match?" & XR, vbYesNo, "Continue?") If carryon = vbYes then 'Rest of code End sub