Macro won't work

  • Thread starter Thread starter Neuther
  • Start date Start date
N

Neuther

i have a macro

here it is

Sub secondattack()
Cells(13, 4).Value = Cells(11, 3).Value + Cells(12, 4) - 2
Cells(13, 3).Value = Cells(13, 3).Value - 2
Cells(12, 4).Value = ""
If Cells(55, 1).Value = 1 And Cells(51, 1).Value = 3 Then
Cells(20, 3).Value = Cells(20, 3).Value - 1
If Cells(55, 1).Value = 1 And Cells(51, 1).Value = 1 Then
Cells(21, 3).Value = Cells(21, 3).Value - 1

End If
End If
End Sub

so i have option buttons that control (51,1) and when it's 3 the
(20,3) subtracts 1 just like it should. But when (51,1) is 1 i
doesn't subtract from (21,3) and i can't figure out how to fix it.

I tried using else and it work's but i need to be able to change (55,1
to 2 and not have it subtract.

hope someone can hel
 
Neuther,

Your IF that tests 51,1 for 1 is inside the IF that tests it for 3, so will
never get executed when it's 1. Move the first End if statement up.
 

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

Back
Top