View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
RussTheBear RussTheBear is offline
external usenet poster
 
Posts: 7
Default macro custom error check

For each matching value I find in column A, I need to check to see whether a
condition is true in another cell in different column but in the same row. I
need to limit the search by the size of the data as opposed to blanks because
there are blanks, so the beginning is necessary.

Range("D10").Select

x = ActiveCell.Row
y = ActiveCell.Column
w = 0

Do While Cells(x, y).Value < ""
x = x + 1
w = w + 1
Loop

Range("A10").Select

x = ActiveCell.Row

Do Until x = w + 10
Cells(x, 1).Select
A = Cells(x, 1).Value
Cells(x, 3).Select
C = Cells(x, 3).Value
If (A = "purchased") And (C = 0) Then
Cells(x, 3).Select
MsgBox "The selected cell SHOULD have a posting reference number."
Exit Sub
Else
x = x + 1
End If

Loop