View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
anon anon is offline
external usenet poster
 
Posts: 77
Default FOR NEXT Problems .....

This may help but it's difficult without your code to understand
better.

In the example below the code checks the values in column a, b and c
plus the row (defined by a) are equal to 1. If so column d and the row
are given the value "Name" & s.

Sub test()
Dim a As Integer
Dim s As Integer
s = 1
For a = 1 To 10
If ActiveSheet.Range("a" & a).Value = 1 Then
If ActiveSheet.Range("b" & a).Value = 1 Then
If ActiveSheet.Range("c" & a).Value = 1 Then
ActiveSheet.Range("d" & a).Value = "Name" & s
s = s + 1
Else
'do nothing
End If
End If
End If
Next a
End Sub