Retype Macro to run properly

Ramadan2512

Board Regular
Joined
Sep 7, 2024
Messages
68
Office Version
  1. 2021
Platform
  1. Windows
I have recorded a Macro to re-arrange my table with color and to sort row by date Ascending but later I needed to add 03 rules to remove all filters in the table to show all data then to go to the last row in table and to save the workbook but it seems that they need to be set in a professional way to run smoothly and properly because it gives me an error in this area - so I need a help to do that please
here is my code
VBA Code:
[
Sub Rearrange()

    Range("B8:K8").Select
    Selection.Copy
    Range("Table1").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWorkbook.Worksheets("Data").ListObjects("Table1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Data").ListObjects("Table1").Sort.SortFields.Add( _
        Range("Table1[[#All],[Column10]]"), xlSortOnCellColor, xlAscending, , _
        xlSortNormal).SortOnValue.Color = RGB(146, 208, 80)
    With ActiveWorkbook.Worksheets("Data").ListObjects("Table1").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
     ActiveSheet.ShowAllData
     ThisWorkbook.Save
    Selection.End(xlDown).Select
End Sub

]
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,812
Messages
6,181,085
Members
453,021
Latest member
Justyna P

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