VBA IF function: when two cells are different
Closed
LanLan
-
25 Nov 2009 à 16:00
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 27 Nov 2009 à 19:26
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 27 Nov 2009 à 19:26
Related:
- VBA IF function: when two cells are different
- Vba find function - Guide
- Hard drive function - Guide
- Vba case like - Guide
- Lan card function - Guide
- How to open vba in excel - Guide
2 responses
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
26 Nov 2009 à 05:18
26 Nov 2009 à 05:18
try this macro
Sub test()
Columns("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess
Dim j As Integer, k As Integer
j = Range("A1").End(xlDown).Row
'j is the last row
For k = j To 2 Step -1
If Cells(k, 1) <> Cells(k - 1, 1) Then
Range(Cells(k, 1), Cells(k + 1, 1)).EntireRow.Insert
End If
Next k
End Sub
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
27 Nov 2009 à 19:26
27 Nov 2009 à 19:26
Try this slightly modified macro
when you invoke th macro
An input box will come up. fill in the initial cell address for e.g A10.
when you invoke th macro
An input box will come up. fill in the initial cell address for e.g A10.
Sub test()
Columns("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess
Dim j As Integer, k As Integer, m As Integer, r As String
r = InputBox("type the first cell under reference e.g. A10")
m = Range(r).Row
j = Range("A10").End(xlDown).Row
'j is the last row
For k = j To m + 1 Step -1
If Cells(k, 1) <> Cells(k - 1, 1) Then
Range(Cells(k, 1), Cells(k + 1, 1)).EntireRow.Insert
End If
Next k
End Sub
27 Nov 2009 à 11:40