Ghais Chatila
New Member
- Joined
- Aug 7, 2009
- Messages
- 30
Hello,
i ran this macro. everything in the first part is executing correctly, and without error, but i am not getting any empty rows inserted between each distinct value in cell A
Sub AC_tab_Matchup()
'
' AC_tab_Matchup Macro
'
ActiveCell.Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 11).Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -10).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 12).Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -10).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Range("A1:I31").Select
Selection.Delete Shift:=xlToLeft
ActiveCell.Offset(1, -3).Range("A1:A30").Select
Selection.NumberFormat = "m/dd/yy;@"
ActiveCell.Offset(0, 2).Range("A1:A30").Select
Selection.NumberFormat = "m/dd/yy;@"
ActiveWindow.LargeScroll ToRight:=-1
ActiveCell.Offset(0, -6).Range("A1:G30").Select
ActiveWorkbook.Worksheets("AC").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("AC").Sort.SortFields.Add2 Key:=ActiveCell.Range( _
"A1:A30"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("AC").Sort
.SetRange ActiveCell.Range("A1:G30")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Sub InsertRowsAtValueChange()
'Update by Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
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
i ran this macro. everything in the first part is executing correctly, and without error, but i am not getting any empty rows inserted between each distinct value in cell A
Sub AC_tab_Matchup()
'
' AC_tab_Matchup Macro
'
ActiveCell.Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 11).Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -10).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 12).Range("A1:A31").Select
Selection.Cut
ActiveCell.Offset(0, -10).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Range("A1:I31").Select
Selection.Delete Shift:=xlToLeft
ActiveCell.Offset(1, -3).Range("A1:A30").Select
Selection.NumberFormat = "m/dd/yy;@"
ActiveCell.Offset(0, 2).Range("A1:A30").Select
Selection.NumberFormat = "m/dd/yy;@"
ActiveWindow.LargeScroll ToRight:=-1
ActiveCell.Offset(0, -6).Range("A1:G30").Select
ActiveWorkbook.Worksheets("AC").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("AC").Sort.SortFields.Add2 Key:=ActiveCell.Range( _
"A1:A30"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("AC").Sort
.SetRange ActiveCell.Range("A1:G30")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Sub InsertRowsAtValueChange()
'Update by Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
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