Macro to find the first cell in a column with different data

L

Lost in Alabama

Hello,

I really could use some of your expert and excellent help with a problem I
am having in creating a macro to perform a search in "Column A" to locate a
change in the data in that column and then move one column to the right and
one row down and type "1" in that cell.

I really appreciate your help, and Have a Blessed Holiday Season.
 
M

Max

Perhaps this might also do it here ..
Assuming data is in A1 down, of the structure as below:

1
1
1
2
2
3
3
etc

Put in B2: =IF(A2<>A1,1,"")
Copy down

Kill the formulas in col B with an in-place:
Copy > Paste special > Check "Values" > OK
 
G

Gord Dibben

Max has provided a formula.

If you want a macro, try this one.

Sub Addone_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) <> Cells(i, 1) Then _
Cells(i, 1).Offset(1, 1).Value = 1
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben Excel MVP

On Wed, 14 Dec 2005 07:06:07 -0800, Lost in Alabama <Lost in
 
Top