Is there a way of speeding up these codes? It takes about 2 minutes to run this code with 6k rows.

Coyotex3

Active Member
Joined
Dec 12, 2021
Messages
496
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Sub OrderFormatting()
    Range("A1:P40000").Select
    With Selection
        .Hyperlinks.Delete
        With Selection
    .Borders.LineStyle = xlNone
            With .Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
            End With
        End With
    End With
    Range("A1:P40000").UnMerge
End Sub

Sub CopyDeleteInsertSortInsertDelete()
    Dim x   As Long, LastRow    As Long
    Dim rng As Range
    
    Range("D:E,K:O").Delete
    Columns("A:O").EntireColumn.AutoFit
    
    For Each rng In Range("D8", Range("D" & Rows.Count).End(xlUp)).SpecialCells(xlConstants).Areas
        rng.Offset(-1, -3).ReSize(rng.Count + 1, 2).FillDown
    Next rng
End Sub

Sub DeleteBlankRows()

With Range("D6:D" & Cells(Rows.Count, "B").End(xlUp).Row)
    .Value = .Value
    .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    
End With

End Sub

Sub EndFormatting()

    Rows(5).Insert

    Range("A6").CurrentRegion.Sort Range("D6"), xlAscending, Range("A6"), , xlAscending, Header:=xlYes

    Const DataCol As String = "D"
    Const StartRow = 6

    LastRow = Cells(Rows.Count, DataCol).End(xlUp).Row

    Application.ScreenUpdating = False

    For x = LastRow To StartRow + 1 Step -1
    
    
        If Cells(x, DataCol).Value <> Cells(x - 1, DataCol) Then Range(DataCol & x & ":" & DataCol & x + 2).EntireRow.Insert
    Next

    Rows("5:5").EntireRow.Delete

    Rows("6:8").EntireRow.Delete
End Sub

Sub UsualS()
  Dim LR As Long, i As Long
  
  Application.ScreenUpdating = False
  LR = Range("A" & Rows.Count).End(xlUp).Row
  For i = LR To 1 Step -1
    If Range("A" & i) = "01" And (Range("D" & i).Value = "bronx" Or Range("D" & i).Value = "brooklyn" Or Range("D" & i).Value = "queens") Then Rows(i).Delete
  Next i
  Application.ScreenUpdating = True
End Sub

Sub RangeLabels11()
Application.ScreenUpdating = False
Dim area As Range, lngRentRow&
For Each area In Columns(1).SpecialCells(2).Areas
lngRentRow = area.Row + area.Rows.Count
With Cells(lngRentRow, 7)
.Value = "Rent"
.Font.Bold = True
.Interior.Color = 5296274
With .Offset(1)
.Value = "Cash"
.Font.Bold = True
.Interior.Color = 65535
End With
End With
Next area
Columns(7).AutoFit
Application.ScreenUpdating = True

ActiveCell.Columns("G:G").EntireColumn.EntireColumn.AutoFit
End Sub

Sub Sorting()
   Dim UsdRws As Long
   
   UsdRws = Range("A" & Rows.Count).End(xlUp).Row
   With Range("A:A").SpecialCells(xlConstants)
      With Range(.Areas(.Areas.Count - 1), Range("A" & UsdRws)).ReSize(, 9)
         .Sort .Range("A1"), xlAscending, .Range("G1"), , xlAscending, Header:=xlNo
      End With
   End With
End Sub

Sub States()
Dim States(4) As Variant
Dim i As Long

States(1) = "nc"
States(2) = "sc"
States(3) = "wa"
States(4) = "ga"

With ActiveSheet
    For i = 1 To 4
        .AutoFilterMode = False
        With Range("d1", Range("d" & Rows.Count).End(xlUp))
            .AutoFilter 1, "*" & States(i) & "*"
            On Error Resume Next
            .Offset(1).SpecialCells(12).EntireRow.Delete
        End With
        .AutoFilterMode = False
    Next i
End With
End Sub

Sub UsualS565()
  Dim LR As Long, i As Long
  
  Application.ScreenUpdating = False
  LR = Range("A" & Rows.Count).End(xlUp).Row
  For i = LR To 1 Step -1
    If Range("A" & i) = "01" And (Range("D" & i).Value = "bronx" Or Range("D" & i).Value = "brooklyn" Or Range("D" & i).Value = "queens") Then Rows(i).Delete
  Next i
  Application.ScreenUpdating = True
End Sub
Sub GetLastRow()
Range("A" & Rows.Count).End(xlUp).Select
 Range(Selection, Selection.End(xlUp)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.ClearContents
End Sub

I have a code which calls all of these macros. Would be great if they could be consolidated and tweaked to make faster. Thank you.
 
Since I can't test it on your actual file, it's hard for me to make any other suggestions. Try closing and then re-opening Excel.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Since I can't test it on your actual file, it's hard for me to make any other suggestions. Try closing and then re-opening Excel.
I did. Was unable to get it to speed up for some reason. The file is between 1,042KB and 1,100KB.
 
Upvote 0
Would be great if they could be consolidated and tweaked to make faster
Try the following macro, it performs row deletion, column deletion and row insertion into memory (with arrays). It only performs in the cells the ordering of the data and the formatting.

Fit the name of your sheet on this line.
Set sh1 = Sheets("Sheet10")

Create a new sheet called "Temp". The results will be on this sheet.
Set sht = Sheets("Temp")

VBA Code:
Sub FormatData_2()
  Dim sh1 As Worksheet, sht As Worksheet
  Dim a As Variant, b As Variant, c As Variant, d As Variant
  Dim i As Long, j As Long, k As Long, lr As Long
  Dim ant As String
  
  Set sh1 = Sheets("Sheet10")
  Set sht = Sheets("Temp")
  a = sh1.Range("A8:P" & sh1.Range("F" & Rows.Count).End(3).Row).Value
  ReDim b(1 To UBound(a, 1), 1 To 9)
  
  For i = 1 To UBound(a)
    If a(i, 1) <> "" And a(i, 2) <> "" Then
      ant = a(i, 1) & "|" & a(i, 2)
    ElseIf a(i, 6) <> "" Then
      If Not (Split(ant, "|")(0) = "10" And InStr("bronx brooklyn queens", a(i, 6)) > 0) Then
        k = k + 1
        For j = 1 To 16
          Select Case j
            Case 1
              b(k, 1) = Split(ant, "|")(0)
              b(k, 2) = Split(ant, "|")(1)
            Case 3
              b(k, 3) = a(i, 3)
            Case 6 To 10
              b(k, j - 2) = a(i, j)
            Case 16
              b(k, j - 7) = a(i, j)
          End Select
        Next
      End If
    End If
  Next

  sht.Cells.ClearContents
  sh1.Range("A5,B5,C5,F5,G5,H5,I5,J5,P5").Copy sht.Range("A5")
  sht.Range("A6").Resize(k, 9).Value = b
  sht.Range("A5").CurrentRegion.Sort sht.Range("D6"), xlAscending, sht.Range("A6"), , xlAscending, Header:=xlYes
  sht.Range("A1:A4").Value = sh1.Range("A1:A4").Value
  Erase a, b
  a = sht.Range("A6:I" & sht.Range("A" & Rows.Count).End(3).Row + 1).Value
  ReDim b(1 To UBound(a, 1) * 4, 1 To 9)

  ant = a(1, 4)
  k = 1
  For i = 1 To UBound(a, 1)
    If ant <> a(i, 4) Then
      b(k + 1, 7) = "Rent"
      b(k + 2, 7) = "Cash"
      k = k + 4
    End If
    For j = 1 To 9
      b(k, j) = a(i, j)
    Next
    ant = a(i, 4)
  Next
  
  sht.Range("A6").Resize(k, 9).Value = b
  With Application.ReplaceFormat
    .Clear
    .Interior.Color = 5296274
    .Font.Bold = True
    sht.Range("G:G").Replace "Rent", "Rent", xlWhole, xlByRows, False, , False, True
    .Interior.Color = 65535
    sht.Range("G:G").Replace "Cash", "Cash", xlWhole, xlByRows, False, , False, True
    .Clear
  End With
  sht.Columns("A:I").EntireColumn.AutoFit
End Sub

Maybe some adjustments have to be made, especially in the part where you sort column G, It only works with the last 2 areas.
VBA Code:
   With Range("A:A").SpecialCells(xlConstants)
      With Range(.Areas(.Areas.Count - 1), Range("A" & UsdRws)).ReSize(, 9)
         .Sort .Range("A1"), xlAscending, .Range("G1"), , xlAscending, Header:=xlNo
      End With
   End With
 
Upvote 0
Try the following macro, it performs row deletion, column deletion and row insertion into memory (with arrays). It only performs in the cells the ordering of the data and the formatting.

Fit the name of your sheet on this line.
Set sh1 = Sheets("Sheet10")

Create a new sheet called "Temp". The results will be on this sheet.
Set sht = Sheets("Temp")

VBA Code:
Sub FormatData_2()
  Dim sh1 As Worksheet, sht As Worksheet
  Dim a As Variant, b As Variant, c As Variant, d As Variant
  Dim i As Long, j As Long, k As Long, lr As Long
  Dim ant As String
 
  Set sh1 = Sheets("Sheet10")
  Set sht = Sheets("Temp")
  a = sh1.Range("A8:P" & sh1.Range("F" & Rows.Count).End(3).Row).Value
  ReDim b(1 To UBound(a, 1), 1 To 9)
 
  For i = 1 To UBound(a)
    If a(i, 1) <> "" And a(i, 2) <> "" Then
      ant = a(i, 1) & "|" & a(i, 2)
    ElseIf a(i, 6) <> "" Then
      If Not (Split(ant, "|")(0) = "10" And InStr("bronx brooklyn queens", a(i, 6)) > 0) Then
        k = k + 1
        For j = 1 To 16
          Select Case j
            Case 1
              b(k, 1) = Split(ant, "|")(0)
              b(k, 2) = Split(ant, "|")(1)
            Case 3
              b(k, 3) = a(i, 3)
            Case 6 To 10
              b(k, j - 2) = a(i, j)
            Case 16
              b(k, j - 7) = a(i, j)
          End Select
        Next
      End If
    End If
  Next

  sht.Cells.ClearContents
  sh1.Range("A5,B5,C5,F5,G5,H5,I5,J5,P5").Copy sht.Range("A5")
  sht.Range("A6").Resize(k, 9).Value = b
  sht.Range("A5").CurrentRegion.Sort sht.Range("D6"), xlAscending, sht.Range("A6"), , xlAscending, Header:=xlYes
  sht.Range("A1:A4").Value = sh1.Range("A1:A4").Value
  Erase a, b
  a = sht.Range("A6:I" & sht.Range("A" & Rows.Count).End(3).Row + 1).Value
  ReDim b(1 To UBound(a, 1) * 4, 1 To 9)

  ant = a(1, 4)
  k = 1
  For i = 1 To UBound(a, 1)
    If ant <> a(i, 4) Then
      b(k + 1, 7) = "Rent"
      b(k + 2, 7) = "Cash"
      k = k + 4
    End If
    For j = 1 To 9
      b(k, j) = a(i, j)
    Next
    ant = a(i, 4)
  Next
 
  sht.Range("A6").Resize(k, 9).Value = b
  With Application.ReplaceFormat
    .Clear
    .Interior.Color = 5296274
    .Font.Bold = True
    sht.Range("G:G").Replace "Rent", "Rent", xlWhole, xlByRows, False, , False, True
    .Interior.Color = 65535
    sht.Range("G:G").Replace "Cash", "Cash", xlWhole, xlByRows, False, , False, True
    .Clear
  End With
  sht.Columns("A:I").EntireColumn.AutoFit
End Sub

Maybe some adjustments have to be made, especially in the part where you sort column G, It only works with the last 2 areas.
VBA Code:
   With Range("A:A").SpecialCells(xlConstants)
      With Range(.Areas(.Areas.Count - 1), Range("A" & UsdRws)).ReSize(, 9)
         .Sort .Range("A1"), xlAscending, .Range("G1"), , xlAscending, Header:=xlNo
      End With
   End With
This is absolutely insane. Like I just pressed f5 and it was done. Would it be possible to tweak the code a bit more? The results I'm getting on sheet("Temp") are not sorting properly. When I run this code, "Rent" and "Cash" is inserted after every row with a value, starting with row(6) until row(262) so the first 200 rows is giving me this. Sorry for not using XL2BB not at my personal laptop at the moment. Besides that it will sort the values in order but it is not sorting them and inserting the page break from row 265 until the end of the sheet. Meaning it is keeping all of them together.

1642512993350.png
 
Upvote 0
@DanteAmor :Well done Danteamor you have done what I could see needed doing and stated in my post 2, but I never had the time and the courage to do it!!
@Coyotex3 Now you see the speed of arrays it is well worth learning how to use them
 
Upvote 0
@DanteAmor :Well done Danteamor you have done what I could see needed doing and stated in my post 2, but I never had the time and the courage to do it!!
@Coyotex3 Now you see the speed of arrays it is well worth learning how to use them
This is absolutely bonkers. I mean you guys all rock. Mumps, JohnnyL, just everybody in general in this sub have been nothing short of amazing.
 
Upvote 0
The results I'm getting on sheet("Temp") are not sorting properly.
I already fixed the code, I was missing an "Else".

Try the following code:
VBA Code:
Sub FormatData_2()
  Dim sh1 As Worksheet, sht As Worksheet
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long
  Dim ant As String
 
  Set sh1 = Sheets("Sheet10")
  Set sht = Sheets("Temp")
  a = sh1.Range("A8:P" & sh1.Range("F" & Rows.Count).End(3).Row).Value
  ReDim b(1 To UBound(a, 1), 1 To 9)
 
  For i = 1 To UBound(a)
    If a(i, 1) <> "" And a(i, 2) <> "" Then
      ant = a(i, 1) & "|" & a(i, 2)
    ElseIf a(i, 6) <> "" Then
      If Not (Split(ant, "|")(0) = "10" And InStr("bronx brooklyn queens", a(i, 6)) > 0) Then
        k = k + 1
        For j = 1 To 16
          Select Case j
            Case 1:       b(k, 1) = Split(ant, "|")(0): b(k, 2) = Split(ant, "|")(1)
            Case 3:       b(k, 3) = a(i, 3)
            Case 6 To 10: b(k, j - 2) = a(i, j)
            Case 16:      b(k, j - 7) = a(i, j)
          End Select
        Next
      End If
    End If
  Next

  sht.Cells.ClearContents
  sh1.Range("A5,B5,C5,F5,G5,H5,I5,J5,P5").Copy sht.Range("A5")
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  sht.Range("A5").CurrentRegion.Sort sht.Range("D6"), xlAscending, sht.Range("A6"), , xlAscending, Header:=xlYes
  sht.Range("A1:A4").Value = sh1.Range("A1:A4").Value
  Erase a, b
  a = sht.Range("A6:I" & sht.Range("A" & Rows.Count).End(3).Row + 1).Value
  ReDim b(1 To UBound(a, 1) * 4, 1 To 9)

  ant = a(1, 4)
  k = 0
  For i = 1 To UBound(a, 1)
    If ant <> a(i, 4) Then
      b(k + 1, 7) = "Rent"
      b(k + 2, 7) = "Cash"
      k = k + 4
    Else
      k = k + 1
    End If
    For j = 1 To 9
      b(k, j) = a(i, j)
    Next
    ant = a(i, 4)
  Next
 
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  With Application.ReplaceFormat
    .Clear
    .Interior.Color = 5296274
    .Font.Bold = True
    sht.Range("G:G").Replace "Rent", "Rent", xlWhole, xlByRows, False, , False, True
    .Interior.Color = 65535
    sht.Range("G:G").Replace "Cash", "Cash", xlWhole, xlByRows, False, , False, True
    .Clear
  End With
  sht.Columns("A:I").EntireColumn.AutoFit
End Sub
 
Upvote 0
I already fixed the code, I was missing an "Else".

Try the following code:
VBA Code:
Sub FormatData_2()
  Dim sh1 As Worksheet, sht As Worksheet
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long
  Dim ant As String
 
  Set sh1 = Sheets("Sheet10")
  Set sht = Sheets("Temp")
  a = sh1.Range("A8:P" & sh1.Range("F" & Rows.Count).End(3).Row).Value
  ReDim b(1 To UBound(a, 1), 1 To 9)
 
  For i = 1 To UBound(a)
    If a(i, 1) <> "" And a(i, 2) <> "" Then
      ant = a(i, 1) & "|" & a(i, 2)
    ElseIf a(i, 6) <> "" Then
      If Not (Split(ant, "|")(0) = "10" And InStr("bronx brooklyn queens", a(i, 6)) > 0) Then
        k = k + 1
        For j = 1 To 16
          Select Case j
            Case 1:       b(k, 1) = Split(ant, "|")(0): b(k, 2) = Split(ant, "|")(1)
            Case 3:       b(k, 3) = a(i, 3)
            Case 6 To 10: b(k, j - 2) = a(i, j)
            Case 16:      b(k, j - 7) = a(i, j)
          End Select
        Next
      End If
    End If
  Next

  sht.Cells.ClearContents
  sh1.Range("A5,B5,C5,F5,G5,H5,I5,J5,P5").Copy sht.Range("A5")
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  sht.Range("A5").CurrentRegion.Sort sht.Range("D6"), xlAscending, sht.Range("A6"), , xlAscending, Header:=xlYes
  sht.Range("A1:A4").Value = sh1.Range("A1:A4").Value
  Erase a, b
  a = sht.Range("A6:I" & sht.Range("A" & Rows.Count).End(3).Row + 1).Value
  ReDim b(1 To UBound(a, 1) * 4, 1 To 9)

  ant = a(1, 4)
  k = 0
  For i = 1 To UBound(a, 1)
    If ant <> a(i, 4) Then
      b(k + 1, 7) = "Rent"
      b(k + 2, 7) = "Cash"
      k = k + 4
    Else
      k = k + 1
    End If
    For j = 1 To 9
      b(k, j) = a(i, j)
    Next
    ant = a(i, 4)
  Next
 
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  With Application.ReplaceFormat
    .Clear
    .Interior.Color = 5296274
    .Font.Bold = True
    sht.Range("G:G").Replace "Rent", "Rent", xlWhole, xlByRows, False, , False, True
    .Interior.Color = 65535
    sht.Range("G:G").Replace "Cash", "Cash", xlWhole, xlByRows, False, , False, True
    .Clear
  End With
  sht.Columns("A:I").EntireColumn.AutoFit
End Sub
This is INSANITY.... Holy Crap........
 
Upvote 0
I already fixed the code, I was missing an "Else".

Try the following code:
VBA Code:
Sub FormatData_2()
  Dim sh1 As Worksheet, sht As Worksheet
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long
  Dim ant As String
 
  Set sh1 = Sheets("Sheet10")
  Set sht = Sheets("Temp")
  a = sh1.Range("A8:P" & sh1.Range("F" & Rows.Count).End(3).Row).Value
  ReDim b(1 To UBound(a, 1), 1 To 9)
 
  For i = 1 To UBound(a)
    If a(i, 1) <> "" And a(i, 2) <> "" Then
      ant = a(i, 1) & "|" & a(i, 2)
    ElseIf a(i, 6) <> "" Then
      If Not (Split(ant, "|")(0) = "10" And InStr("bronx brooklyn queens", a(i, 6)) > 0) Then
        k = k + 1
        For j = 1 To 16
          Select Case j
            Case 1:       b(k, 1) = Split(ant, "|")(0): b(k, 2) = Split(ant, "|")(1)
            Case 3:       b(k, 3) = a(i, 3)
            Case 6 To 10: b(k, j - 2) = a(i, j)
            Case 16:      b(k, j - 7) = a(i, j)
          End Select
        Next
      End If
    End If
  Next

  sht.Cells.ClearContents
  sh1.Range("A5,B5,C5,F5,G5,H5,I5,J5,P5").Copy sht.Range("A5")
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  sht.Range("A5").CurrentRegion.Sort sht.Range("D6"), xlAscending, sht.Range("A6"), , xlAscending, Header:=xlYes
  sht.Range("A1:A4").Value = sh1.Range("A1:A4").Value
  Erase a, b
  a = sht.Range("A6:I" & sht.Range("A" & Rows.Count).End(3).Row + 1).Value
  ReDim b(1 To UBound(a, 1) * 4, 1 To 9)

  ant = a(1, 4)
  k = 0
  For i = 1 To UBound(a, 1)
    If ant <> a(i, 4) Then
      b(k + 1, 7) = "Rent"
      b(k + 2, 7) = "Cash"
      k = k + 4
    Else
      k = k + 1
    End If
    For j = 1 To 9
      b(k, j) = a(i, j)
    Next
    ant = a(i, 4)
  Next
 
  sht.Range("A6").Resize(k, 9).Value = b    'Pass array to cells
  With Application.ReplaceFormat
    .Clear
    .Interior.Color = 5296274
    .Font.Bold = True
    sht.Range("G:G").Replace "Rent", "Rent", xlWhole, xlByRows, False, , False, True
    .Interior.Color = 65535
    sht.Range("G:G").Replace "Cash", "Cash", xlWhole, xlByRows, False, , False, True
    .Clear
  End With
  sht.Columns("A:I").EntireColumn.AutoFit
End Sub
This code was instant and it was able to sort the data in the way I originally intended.

@DanteAmor Thank you for this code.
@johnnyL @mumps Thank you guys as well for helping out greatly on multiple occasions as well.
 
Upvote 0
Maybe some adjustments have to be made, especially in the part where you sort column G, It only works with the last 2 areas.
VBA Code:
   With Range("A:A").SpecialCells(xlConstants)
      With Range(.Areas(.Areas.Count - 1), Range("A" & UsdRws)).ReSize(, 9)
         .Sort .Range("A1"), xlAscending, .Range("G1"), , xlAscending, Header:=xlNo
      End With
   End With
That code works in my current situation because the last two areas in my file are alphanumeric and I want to keep them together and resort by A and then G.

In a similar range like this

Example.(19337).xlsx
ABCDEFGHI
1Report
2User1
3Period: 11/2021
4As of : 11/18/2021
5OrderNameDescriptionCityDateInfoOrder#1Other Info
6DanteDante210/15-10-20Mexico10/21/2021Non Avilable12500.00None
7DanteDante310/15-10-21Mexico10/22/2021Non Avilable13500.00None
8DanteDante410/15-10-22Jalisco0310/23/2021Non Avilable14500.00None
9DanteDante510/15-10-23Jalisco0310/24/2021Non Avilable14500.00None
10DanteDante610/15-10-2450Guadalajara50010/25/2021Non Avilable14500.00None
11CoyoteCoyote01/15-09/2050Guadalajara60010/15/2020Non Avilable151,000.00None
12CoyoteCoyote01/15-09/2150Guadalajara70010/16/2020Non Avilable161,000.00None
13CoyoteCoyote01/15-09/2201Cabo10/17/2020Non Avilable171,000.00None
14CoyoteCoyote01/15-09/2302Cabo10/18/2020Non Avilable191,000.00None
15CoyoteCoyote01/15-09/2403Cabo10/19/2020Non Avilable201,000.00None
16ExcelExcel01/10-12/31Cancun10/21/2020Non Avilable251,000.00None
Report1


I'm able to accomplish this:

Example.(19337).xlsx
ABCDEFGHI
1Report
2User1
3Period: 11/2021
4As of : 11/18/2021
5OrderNameDescriptionCityDateInfoOrder#1Other Info
6CoyoteCoyote01/15-09/2201Cabo10/17/2020Non Avilable171,000.00None
7CoyoteCoyote01/15-09/2302Cabo10/18/2020Non Avilable191,000.00None
8CoyoteCoyote01/15-09/2403Cabo10/19/2020Non Avilable201,000.00None
9DanteDante610/15-10-2450Guadalajara50010/25/2021Non Avilable14500.00None
10CoyoteCoyote01/15-09/2050Guadalajara60010/15/2020Non Avilable151,000.00None
11CoyoteCoyote01/15-09/2150Guadalajara70010/16/2020Non Avilable161,000.00None
12ExcelExcel01/10-12/31Cancun10/21/2020Non Avilable251,000.00None
13DanteDante410/15-10-22Jalisco0310/23/2021Non Avilable14500.00None
14DanteDante510/15-10-23Jalisco0310/24/2021Non Avilable14500.00None
15DanteDante210/15-10-20Mexico10/21/2021Non Avilable12500.00None
16DanteDante310/15-10-21Mexico10/22/2021Non Avilable13500.00None
Report1


But do not know how to get this

Example.(19337).xlsx
ABCDEFGHI
1Report
2User1
3Period: 11/2021
4As of : 11/18/2021
5OrderNameDescriptionCityDateInfoOrder#1Other Info
6CoyoteCoyote01/15-09/2201Cabo10/17/2020Non Avilable171,000.00None
7CoyoteCoyote01/15-09/2302Cabo10/18/2020Non Avilable191,000.00None
8CoyoteCoyote01/15-09/2403Cabo10/19/2020Non Avilable201,000.00None
9
10
11
12DanteDante610/15-10-2450Guadalajara50010/25/2021Non Avilable14500.00None
13CoyoteCoyote01/15-09/2050Guadalajara60010/15/2020Non Avilable151,000.00None
14CoyoteCoyote01/15-09/2150Guadalajara70010/16/2020Non Avilable161,000.00None
15
16
17
18ExcelExcel01/10-12/31Cancun10/21/2020Non Avilable251,000.00None
19
20
21
22DanteDante410/15-10-22Jalisco0310/23/2021Non Avilable14500.00None
23DanteDante510/15-10-23Jalisco0310/24/2021Non Avilable14500.00None
24
25
26
27DanteDante210/15-10-20Mexico10/21/2021Non Avilable12500.00None
28DanteDante310/15-10-21Mexico10/22/2021Non Avilable13500.00None
Report1


The code I gathered previously would insert 3 empty columns at page break. I could not figure out how to sort and keep the alphanumeric areas together, so I relied on that code in question to resort the last two areas as those were the only alphanumeric areas in my sheet.

I would love to be able to keep the alphanumeric cities grouped together.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,914
Messages
6,122,211
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top