Message to appear when 5 cells uncolored cells contain values.

Solved/Closed
Fmss8404 Posts 1 Registration date Monday August 12, 2019 Status Member Last seen August 12, 2019 - Updated on Aug 12, 2019 at 09:52 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 13, 2019 at 11:50 AM
Hello,
A macro using excel that can return a message when 5 uncolored cells that are in a range of colored and uncolored cells contain values. The message to display “5”.
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Aug 13, 2019 at 11:50 AM
Hi Fmss8404,

To do that specific task, give the following code a try:
Sub RunMe()
Dim x, y As Integer, mRange As Range

Set mRange = Application.InputBox("Select range", Type:=8)

For Each cell In mRange
    If cell.Interior.Pattern = xlNone Then x = x + 1
    If cell.Value <> vbNullString Then y = y + 1
Next cell

If x = 5 And y = 5 Then MsgBox ("5")
End Sub


Best regards,
Trowa
0