Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Finding blank cell

Hai iam creating standard template where cells having different formulas &
validation. My query is i dont want to left any cells blank. Is there any
macro to find the blank cell (within certain range) and if it find blank
cell, error message has to come stating particular cell number is blank.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Finding blank cell

Hi,

Right click the sheet tab, view code and paste this in.

Sub blanks()
Set myrange = Range("A1:A100") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
End Sub

Mike



"gane" wrote:

Hai iam creating standard template where cells having different formulas &
validation. My query is i dont want to left any cells blank. Is there any
macro to find the blank cell (within certain range) and if it find blank
cell, error message has to come stating particular cell number is blank.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Finding blank cell

Thanks mike
itz working fine . but if all the cells are filled i want to show separate
message that all cells are filled.

"Mike H" wrote:

Hi,

Right click the sheet tab, view code and paste this in.

Sub blanks()
Set myrange = Range("A1:A100") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
End Sub

Mike



"gane" wrote:

Hai iam creating standard template where cells having different formulas &
validation. My query is i dont want to left any cells blank. Is there any
macro to find the blank cell (within certain range) and if it find blank
cell, error message has to come stating particular cell number is blank.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Finding blank cell

Thanks itz working great. In addition to this ............
I had assign this macro to a command button in excel sheet. By pressing the
button the macro is working fine. I want to automatically disappear/hide that
command button once after the message box shows 0 blank cells

"Mike Fogleman" wrote:

That will fail if only 1 cell is left blank. Need to use found as the
criteria.

Sub blanks()
Dim myrange As Range, c As Range
Dim found As Integer
Dim myaddress As String
Dim count As Long
Set myrange = Range("A1:A10") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myaddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
count = count + 1
End If
Next
If found = 1 Then
MsgBox myaddress & " has not been populated and there are " _
& count & " other blanks"
Else
MsgBox "All cells are filled"
End If
End Sub

Mike F
"Mike H" wrote in message
...
Then use this moddified version:-

Sub blanks()
Set myrange = Range("A1:A10") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
If Count 0 Then
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
Else
MsgBox "All cells filled"
End If
End Sub

Mike

"gane" wrote:

Thanks mike
itz working fine . but if all the cells are filled i want to show
separate
message that all cells are filled.

"Mike H" wrote:

Hi,

Right click the sheet tab, view code and paste this in.

Sub blanks()
Set myrange = Range("A1:A100") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
End Sub

Mike



"gane" wrote:

Hai iam creating standard template where cells having different
formulas &
validation. My query is i dont want to left any cells blank. Is there
any
macro to find the blank cell (within certain range) and if it find
blank
cell, error message has to come stating particular cell number is
blank.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Finding blank cell

Put these lines wherever you want to show/hide the button. Change the sheet
reference to your sheet with the button.

Sheet1.CommandButton1.Visible = True
Sheet1.CommandButton1.Visible = False

Mike F
"gane" wrote in message
...
Thanks itz working great. In addition to this ............
I had assign this macro to a command button in excel sheet. By pressing
the
button the macro is working fine. I want to automatically disappear/hide
that
command button once after the message box shows 0 blank cells

"Mike Fogleman" wrote:

That will fail if only 1 cell is left blank. Need to use found as the
criteria.

Sub blanks()
Dim myrange As Range, c As Range
Dim found As Integer
Dim myaddress As String
Dim count As Long
Set myrange = Range("A1:A10") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myaddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
count = count + 1
End If
Next
If found = 1 Then
MsgBox myaddress & " has not been populated and there are " _
& count & " other blanks"
Else
MsgBox "All cells are filled"
End If
End Sub

Mike F
"Mike H" wrote in message
...
Then use this moddified version:-

Sub blanks()
Set myrange = Range("A1:A10") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
If Count 0 Then
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
Else
MsgBox "All cells filled"
End If
End Sub

Mike

"gane" wrote:

Thanks mike
itz working fine . but if all the cells are filled i want to show
separate
message that all cells are filled.

"Mike H" wrote:

Hi,

Right click the sheet tab, view code and paste this in.

Sub blanks()
Set myrange = Range("A1:A100") 'Change to suit
For Each c In myrange
If found < 1 And IsEmpty(c.Value) Then
found = 1
myAddress = c.Address
ElseIf found = 1 And IsEmpty(c.Value) Then
Count = Count + 1
End If
Next
MsgBox myAddress & " has not been populated and there are " _
& Count & " other blanks"
End Sub

Mike



"gane" wrote:

Hai iam creating standard template where cells having different
formulas &
validation. My query is i dont want to left any cells blank. Is
there
any
macro to find the blank cell (within certain range) and if it find
blank
cell, error message has to come stating particular cell number is
blank.






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
Finding Next Blank Cell in Blank Row Nick Wakeham Excel Worksheet Functions 3 June 11th 08 02:15 PM
Finding next non-blank cell Stu[_2_] Excel Discussion (Misc queries) 4 October 23rd 07 01:29 PM
Finding next blank cell JaiD Excel Programming 2 June 13th 04 10:23 AM
Finding the Blank Cell Cory Thomas[_2_] Excel Programming 0 June 2nd 04 05:54 PM
Finding first non-blank cell Allison[_2_] Excel Programming 7 October 18th 03 01:47 AM


All times are GMT +1. The time now is 06:54 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"