![]() |
Macro to find the first cell in a column with different data
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. |
Macro to find the first cell in a column with different data
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 -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- "Lost in Alabama" <Lost in wrote in message ... 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. |
Macro to find the first cell in a column with different data
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 wrote: 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. |
All times are GMT +1. The time now is 01:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com