Message to appear when 5 cells uncolored cells contain values. [Solved]

Posts
1
Registration date
Monday August 12, 2019
Status
Member
Last seen
August 12, 2019
-
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”.
See more 

1 reply

Posts
2567
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 21, 2019
370
0
Thank you
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
Respond to TrowaD