macro help

C

candyyoung

I am just learning Excel and I am trying to add a formula to some cells
to do multiple functions. Here is what I am trying to do: IF G2=1 and
H2=1, add "1" to E2 and delete G2 and H2. I have been told I need t
create a macro for this. Any help on how to do it
 
D

Dave Peterson

I think your code (with no validation at all!) would look something like:

Option Explicit
Sub testme01()

With Worksheets("sheet1")
If .Range("g2").Value = 1 _
And .Range("H2").Value = 1 Then
.Range("e2").Value = .Range("e2").Value + 1
.Range("g2:h2").ClearContents
End If
End With

End Sub

But when you run it is a question to me.
 
Top