condition for run macro

K

kalpesh

Hello

in worksheet 1 i create a macro for change font color of "C1" cel
when i click command button but i use this macro when "A1"
"D10", "e15" cell value is enter then run this macro else
massage box shown please enter data in a1,d10,e15 cel
how
 
G

Gord Dibben

Sub click()
Dim rng As Range
Set rng = Range("A1, D10, E15")
If Application.WorksheetFunction.CountA(rng) < 3 Then
MsgBox "Please fill A1, D10 and E15"
Else
Range("C1").Font.ColorIndex = 3
End If
End Sub


Gord
 
G

Gord Dibben

You don't need a macro............you could use Conditional
Formatting.

But I have posted a macro in other reply.


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top