#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default blank cells

Have the following to check for blank cells. Would like to have message box
appear if blank cells exist. Then give user option to correct. OR Maybe best
to just return to worksheet being checked if blank cells exist?
Thanks

Worksheets("MailD").Activate
Dim Blanks As Long
Dim LastRow As Integer
Blanks = msgbox(Prompt:="Do you have blanks to complete?,If not sure
Click on Yes", Buttons:=vbYesNo)
If Blanks = vbYes Then
LastRow = Cells(Rows.Count, "A").End(xlUp).row
range("A2:F2").Resize(LastRow - 4).Select
Userform1_Main_form.Hide
Selection.specialcells(xlCellTypeBlanks).Select
End If

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default blank cells

You could trap the error that occurs when you look for blankcells:

Sub TryNow()
Dim Blanks As VbMsgBoxResult
Dim LastRow As Long
Dim myR As Range

With Worksheets("MailD")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
On Error GoTo NoBlanks
Set myR = .Range("A2:F2").Resize(LastRow - 4).SpecialCells(xlCellTypeBlanks)
Blanks = MsgBox("Do you want to complete blanks?", vbYesNo)
If Blanks = vbYes Then
myR.Select
End If
NoBlanks:
End With

End Sub


--
HTH,
Bernie
MS Excel MVP


"Curt" wrote in message
...
Have the following to check for blank cells. Would like to have message box
appear if blank cells exist. Then give user option to correct. OR Maybe best
to just return to worksheet being checked if blank cells exist?
Thanks

Worksheets("MailD").Activate
Dim Blanks As Long
Dim LastRow As Integer
Blanks = msgbox(Prompt:="Do you have blanks to complete?,If not sure
Click on Yes", Buttons:=vbYesNo)
If Blanks = vbYes Then
LastRow = Cells(Rows.Count, "A").End(xlUp).row
range("A2:F2").Resize(LastRow - 4).Select
Userform1_Main_form.Hide
Selection.specialcells(xlCellTypeBlanks).Select
End If



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Array Formula for Counting Blank & Non Blank Cells (Multiple Criteria) foofoo Excel Discussion (Misc queries) 3 February 20th 12 08:03 PM
Excel 2002: Return blank when VLOOKUP on blank cells Mr. Low Excel Discussion (Misc queries) 2 June 4th 09 05:12 PM
Maximum Number of Blank Cells between Non Blank Cells in a Range Mal Excel Worksheet Functions 5 November 3rd 07 08:21 AM
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... [email protected][_2_] Excel Programming 2 June 7th 07 09:27 PM
Copy to first Blank cell in Colum C Non blank cells still exist be Ulrik loves horses Excel Programming 2 October 8th 06 07:35 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"