Inserting a row when the value of a field changes
Solved/Closed
kkautz
Posts
1
Registration date
Friday April 25, 2014
Status
Member
Last seen
April 25, 2014
-
Apr 25, 2014 at 03:06 PM
KKautz - Apr 28, 2014 at 09:51 AM
KKautz - Apr 28, 2014 at 09:51 AM
Related:
- Inserting a row when the value of a field changes
- Saints row 2 cheats - Guide
- Where is the insert key on a laptop - Guide
- How to delete a row in word - Guide
- The following excel image has a vba program (see below). what will be the result after the program is executed? any cells not displayed are currently empty, and any cells with numbers are formatted numeric. sub afdo a=0 lastrow = cels(rows. count, 1). end(xdup). row for i =14 to lastrow step 2 a=a cellsii. 5) value next cells(lastrow 2, 1) value = "the sum - Guide
- Insert a checkmark in word - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Apr 26, 2014 at 07:55 AM
Apr 26, 2014 at 07:55 AM
data is like this
hdng1
a
a
a
d
d
d
d
d
d
f
will this macro help
hdng1
a
a
a
d
d
d
d
d
d
f
will this macro help
Sub test()
Dim j As Integer, k As Integer
j = Range("A1").End(xlDown).Row
For k = j To 3 Step -1
If Cells(k, 1) <> Cells(k - 1, 1) Then Cells(k, 1).EntireRow.Insert
Next k
End Sub
Apr 28, 2014 at 09:51 AM
'Insert a new row if the values in either column A or B changes
'Copy the heading to the inserted row
Dim LR As Long, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = LR To 5 Step -1
If Range("A" & i).Value <> Range("A" & i - 1).Value Or Range("B" & i).Value <> Range("B" & i - 1).Value Then Rows(i).Insert
Rows("2:2").Select
Selection.Copy
Next i
Range("A1").Select
MsgBox "Done"