Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default Macro display Msgbox when cells are empty

Hi- I want to create a macro that will display a message box when cells are
empty. For example, lets say use cell range F15:G17. If any of these cells
are empty, I want the message box to pop up. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro display Msgbox when cells are empty

hi
play around with something like this....
Sub countrange()
Dim cnt As Long
Dim cell As Range

cnt = 0
For Each cell In Selection ' change selection to your range
If IsEmpty(cell) Then
cnt = cnt + 1
End If
Next
MsgBox ("there are " & cnt & " empty cells in the range")
End Sub

regards
FSt1
"jackie" wrote:

Hi- I want to create a macro that will display a message box when cells are
empty. For example, lets say use cell range F15:G17. If any of these cells
are empty, I want the message box to pop up. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Macro display Msgbox when cells are empty

One way:

You don't say what should trigger the macro, so I'll assume that they're
all filled in to start, and you want to detect if they're left blank.

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Range("F15:G17")
If Not Intersect(.Cells, Target) Is Nothing Then
If Application.CountA(.Cells) < .Count Then _
MsgBox "Cells " & .Address(False, False) & _
" must all be filled in!"
End If
End With
End Sub


In article ,
jackie wrote:

Hi- I want to create a macro that will display a message box when cells are
empty. For example, lets say use cell range F15:G17. If any of these cells
are empty, I want the message box to pop up. Thanks.

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
How to display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
How to make Excel Chart not to display empty cells? Marko Pinteric Charts and Charting in Excel 6 April 5th 06 09:03 PM
How to make Excel Chart not to display empty cells? Marko Pinteric Excel Discussion (Misc queries) 6 April 5th 06 09:03 PM
Display empty cells botany_girl Excel Discussion (Misc queries) 7 July 19th 05 06:40 PM
Display empty cells botany_girl Excel Discussion (Misc queries) 1 July 19th 05 05:51 PM


All times are GMT +1. The time now is 02:54 PM.

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

About Us

"It's about Microsoft Excel"