Recorded macro needs to be simplified

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,596
Office Version
  1. 2007
Platform
  1. Windows
Morning,

I was unable to achieve what i required so had to record a macro to get my end result.
I have now supplied two codes below.

First code is my recorded macro which i would like to be simplified / cleaned up a little.

Second code is a working macro already in place BUT would like the recorded macro added to the end of it.

Code:
Sub TESTSORT3()'
' TESTSORT3 Macro
'


'
    Sheets("SOLD ITEMS").Select
    Range("C2:D14").Select
    Selection.Copy
    Sheets("HONDA SHEET").Select
    Range("C1").Select
    ActiveSheet.Paste
    Sheets("SOLD ITEMS").Select
    Range("C15:D27").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("HONDA SHEET").Select
    Range("E1:F13").Select
    ActiveSheet.Paste
    Range("C1:F13").Select
    Application.CutCopyMode = False
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent5
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
    End With
    Range("C1").Select
    Sheets("SOLD ITEMS").Select
    Range("C2").Select
    Sheets("HONDA SHEET").Select
    ActiveWorkbook.Save
End Sub


Code:
Sub LEADERBOARD()    '' leaderboard Macro'    Worksheets("HONDA SHEET").Range("C1:D13").Copy Worksheets("SOLD ITEMS").Range("C2:D15")
    Worksheets("HONDA SHEET").Range("E1:F13").Copy Worksheets("SOLD ITEMS").Range("C15:D27")


    ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Add Key:=Range("D2"), _
    SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
    xlSortTextAsNumbers
    With Worksheets("SOLD ITEMS").Sort
        .SetRange Range("C2:D27")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With


    With Worksheets("SOLD ITEMS").Range("C2:D27").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        End With
    Application.Goto Sheets("SOLD ITEMS").Range("A5")
End Sub


Thanks very much
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try
Code:
Sub TESTSORT3() '
    Sheets("SOLD ITEMS").Range("C2:D14").Copy Sheets("HONDA SHEET").Range("C1")
    Sheets("SOLD ITEMS").Range("C15:D27").Copy Sheets("HONDA SHEET").Range("E1")
    With Sheets("HONDA SHEET").Range("C1:F13").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent5
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
    End With
    ActiveWorkbook.Save
End Sub


Code:
Sub LEADERBOARD()    '' leaderboard Macro'    Worksheets("HONDA SHEET").Range("C1:D13").Copy Worksheets("SOLD ITEMS").Range("C2:D15")
    Worksheets("HONDA SHEET").Range("E1:F13").Copy Worksheets("SOLD ITEMS").Range("C15:D27")


    ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Add Key:=Range("D2"), _
    SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
    xlSortTextAsNumbers
    With Worksheets("SOLD ITEMS").Sort
        .SetRange Range("C2:D27")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With


    With Worksheets("SOLD ITEMS").Range("C2:D27").Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        End With
    Application.Goto Sheets("SOLD ITEMS").Range("A5")
Call TESTSORT3
End Sub
 
Upvote 0
Thanks but how would the first code then be added to the second code so its all then one code to run ?
 
Upvote 0
Many thanks,

I now see what you did.

Code:
[COLOR=#333333]Call TESTSORT3[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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