If then VB statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My attempt doesn't work:

If Columns("B:B") = "A" And Columns("N:N") = "manual Calc" Then
Columns("O:O") = "0"

I need it to see if column B has value "A" in it with a matching row of
column N with value "manual Calc" and if true then set the same rows column O
to a value of "0".
Thanks in advance for your expert advice!
 
try this for-next loop.

Sub readcolumns()
For x = 1 To 65536
If Worksheets("Sheet1").Cells(x, 2).Text = "B" And _
Worksheets("Sheet1").Cells(x, 14).Text = "manual calc" Then
Worksheets("Sheet1").Cells(x, 15).Value = "o"
flag = 1
End If
Next
End Sub

Mike
 
Works like magic! Thanks a ton for your help!

Mike said:
try this for-next loop.

Sub readcolumns()
For x = 1 To 65536
If Worksheets("Sheet1").Cells(x, 2).Text = "B" And _
Worksheets("Sheet1").Cells(x, 14).Text = "manual calc" Then
Worksheets("Sheet1").Cells(x, 15).Value = "o"
flag = 1
End If
Next
End Sub

Mike
 

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