In article <07671D49-6760-48F5-B35E-0D85010E1F05 DeleteThis @microsoft.com>,
Carrie <Carrie DeleteThis @discussions.microsoft.com> wrote:
> I have a very large range whereas I have 0's, 1's and 2's. The values
> represent dates for classes in columns. (Example: Column D represents an
> instructor and at some location down the column there is a 1 for start date
> and a 2 for an end date. All other cells are 0's. see below)
>
> When the 1 is found, I need all subsequent 0's between the 1 and 2 to be 1's
> as well as the 2 to be replaced by a 1.
>
> I cannot figure this out, can anyone help?
One way:
Dim rCell As Range
Dim nVal As Long
For Each rCell In Range("D2:D" & _
Range("D" & Rows.Count).End(xlUp).Row)
With rCell
If .Value = 0 Then
.Value = nVal
Else
nVal = 1 - nVal
End If
End With
Next rCell
>> Stay informed about: visual basic data fill?