Good morning,

Is there a way to run both the Macros below with one Short cut key?

I have tried combining the Macros... something goes wrong.

I have tried:
Sub CallMacros()
CopySource
CopyTrend
End Sub
...something goes wrong.


Sub CopySource() Dim rngSource As Range Dim rngTarget As Range Dim iRow As Integer Set rngSource = Worksheets("DATA").Range("Source") iRow = Worksheets("MERGED").Cells(Rows.Count, 1).End(xlUp).Row + 1 Set rngTarget = Worksheets("MERGED").Range("B" & iRow) rngSource.Copy Destination:=rngTarget Range("A6:G25").Select ActiveWorkbook.Worksheets("SUMMARY").SORT.SortFields.Clear ActiveWorkbook.Worksheets("SUMMARY").SORT.SortFields.Add Key:=Range("G6:G25") _ , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("SUMMARY").SORT .SetRange Range("A6:G25") .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Range("A1").Select End Sub
AND

Sub CopyTrend() Range("E3:F22").SORT Key1:=Range("F3"), Order1:=xlAscending, _ Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Dim column_number As Long column_number = ActiveSheet.Cells.Find(What:="*", After:=Range("IV65536"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1 Range(Cells(3, column_number), Cells(22, column_number + 1)).Value = Range("E3:F22").Value End Sub
I think the problem might be that my second Macro:

Sub CopyTrend() Range("E3:F22").SORT Key1:=Range("F3"), Order1:=xlAscending, _ Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Dim column_number As Long column_number = ActiveSheet.Cells.Find(What:="*", After:=Range("IV65536"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1 Range(Cells(3, column_number), Cells(22, column_number + 1)).Value = Range("E3:F22").Value End Sub

the part in red... is not specifis to a worksheet.

Anyone know how I can do that?



Thanks for any help!