Hi everyone, please help me point out the error on this code please:
When I called the sub above with a Private sub worksheet change at range B10:B30, the code just did the part after ELSE that format all cell at F column to #,##0.00, not just the cell I input value; and the first part before ELSE was not workingSub format()
dim nd as range, cell as range, ws as worksheet
set ws = Activesheet
set nd = ws.range("B10:E30") ' B10:E10 to B30:E30 are merge cell
For Each cell in nd
IF cell.Value = ws.Range("L22").Value or cell.value = ws.Range("L23").value Then 'there are more value than this...
cell.Offset(0, 2).NumberFormat = "General"
ELSE
cell.Offset(0, 2).NumberFormat = "#,##0.00"
End If
Next
End Sub