![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 3
|
I have a macro recorded to remove data from the worksheet, paste it elsewhere, clear the original data and let the user strat from scratch again.
I need to place a code before the main bulk of the macro to stop it running if any of the 15 or so cells is empty. There was a similar question but it referred to one cell only, have tried to manipulate it but keep getting errors. Cheers |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
If your range is in, say A1:A15 then the following could be suitable: -
Dim c As Range Dim myRng As Range Set myRng = ActiveSheet.Range("A1:A15") ' Change your range here to suit For Each c In myRng If IsEmpty(c) Then MsgBox "Cell " & c.Address & " is empty. Terminating": Exit Sub Next c |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|