View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Stan Lo Stan Lo is offline
external usenet poster
 
Posts: 7
Default If then VB statement

Hi Mike

What does the flag=1 do?

thanks
Slo

?B?TWlrZQ==?= wrote in
:

Your welcome and thanks for the feedback.

"bill ch" wrote:

Works like magic! Thanks a ton for your help!

"Mike" wrote:

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

"bill ch" wrote:

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!