Created
July 22, 2017 14:35
-
-
Save ndthanh/df68f248adbf03197ab376100af46dcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub InsertRowsAtValueChange() | |
'Update 20140716 | |
Dim Rng As Range | |
Dim WorkRng As Range | |
On Error Resume Next | |
xTitleId = "Hoc Excel Online" | |
Set WorkRng = Application.Selection | |
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) | |
Application.ScreenUpdating = False | |
For i = WorkRng.Rows.Count To 2 Step -1 | |
If WorkRng.Cells(i, 1).Value <> WorkRng.Cells(i - 1, 1).Value Then | |
WorkRng.Cells(i, 1).EntireRow.Insert | |
End If | |
Next | |
Application.ScreenUpdating = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment