View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default run macro only if condition is met

Sub Macro1()
If Cells(1, 1) = 1 Then
Exit Sub
Else
MsgBox ("HI")
End If
End Sub

--
Gary's Student


"Nikonov" wrote:

I need to run a macro (copy one cell into another) only if a certain
condition is met. For example, if x=a, then run this macro. If not, do
something else.