Seamus2626
asked on
Macro not executing
I have the below code.
When another macro1 runs, i want this to run afterwards.
I have tried calling it at the end of macro1. It calls the code but doesnt execute it.
What the code is simply doing is unhiding a tab, changing some headings and rehiding the tab.
But the headings arent changing even though the below macro is being called
Thanks
Seamus
Sub Update3()
'
' Update3 Macro
' Macro recorded 18/10/2010 by seamus
'
' Keyboard Shortcut: Ctrl+s
'
MsgBox "The call worked"
Range("F31").Select
Sheets("COUPONS RAW DATA").Visible = True
Range("L213").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Range("AM4").Select
Range(Selection, Selection.End(xlToRight)). Select
Selection.Copy
Range("AM4").Select
Range(Selection, Selection.End(xlToRight)). Select
Application.CutCopyMode = False
Selection.Cut
Range("G6").Select
ActiveCell.FormulaR1C1 = "Redemption proceeds"
Range("H6").Select
ActiveCell.FormulaR1C1 = "End cash"
Range("I6").Select
ActiveCell.FormulaR1C1 = "Outstanding cash"
Range("J6").Select
ActiveCell.FormulaR1C1 = "Current cash (base)"
Range("K6").Select
ActiveCell.FormulaR1C1 = "Failed trade flag"
Range("L6").Select
ActiveCell.FormulaR1C1 = "Income type"
Range("M6").Select
ActiveCell.FormulaR1C1 = "Item type"
Range("N6").Select
ActiveCell.FormulaR1C1 = "P/R"
Range("O6").Select
ActiveCell.FormulaR1C1 = "ISIN"
Range("P6").Select
ActiveCell.FormulaR1C1 = "Ex date"
Range("Q6").Select
ActiveCell.FormulaR1C1 = "Rec date"
Range("R6").Select
ActiveCell.FormulaR1C1 = "Pay date"
Range("S6").Select
ActiveCell.FormulaR1C1 = "Notes"
Range("T6").Select
ActiveCell.FormulaR1C1 = "Request"
Range("U6").Select
ActiveCell.FormulaR1C1 = "Age (Days)"
Range("V6").Select
ActiveCell.FormulaR1C1 = "Age category"
Range("W6").Select
ActiveCell.FormulaR1C1 = "Rqst no"
Range("X4").Select
Range(Selection, Selection.End(xlToLeft)).S elect
Selection.ClearContents
Range("A5").Select
Sheets("BY YEAR").Select
Range("I8").Select
Sheets("COUPONS RAW DATA").Select
Range("D43").Select
ActiveWindow.SelectedSheet s.Visible = False
Sheets("BY YEAR").Select
Range("G12").Select
End Sub
When another macro1 runs, i want this to run afterwards.
I have tried calling it at the end of macro1. It calls the code but doesnt execute it.
What the code is simply doing is unhiding a tab, changing some headings and rehiding the tab.
But the headings arent changing even though the below macro is being called
Thanks
Seamus
Sub Update3()
'
' Update3 Macro
' Macro recorded 18/10/2010 by seamus
'
' Keyboard Shortcut: Ctrl+s
'
MsgBox "The call worked"
Range("F31").Select
Sheets("COUPONS RAW DATA").Visible = True
Range("L213").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Range("AM4").Select
Range(Selection, Selection.End(xlToRight)).
Selection.Copy
Range("AM4").Select
Range(Selection, Selection.End(xlToRight)).
Application.CutCopyMode = False
Selection.Cut
Range("G6").Select
ActiveCell.FormulaR1C1 = "Redemption proceeds"
Range("H6").Select
ActiveCell.FormulaR1C1 = "End cash"
Range("I6").Select
ActiveCell.FormulaR1C1 = "Outstanding cash"
Range("J6").Select
ActiveCell.FormulaR1C1 = "Current cash (base)"
Range("K6").Select
ActiveCell.FormulaR1C1 = "Failed trade flag"
Range("L6").Select
ActiveCell.FormulaR1C1 = "Income type"
Range("M6").Select
ActiveCell.FormulaR1C1 = "Item type"
Range("N6").Select
ActiveCell.FormulaR1C1 = "P/R"
Range("O6").Select
ActiveCell.FormulaR1C1 = "ISIN"
Range("P6").Select
ActiveCell.FormulaR1C1 = "Ex date"
Range("Q6").Select
ActiveCell.FormulaR1C1 = "Rec date"
Range("R6").Select
ActiveCell.FormulaR1C1 = "Pay date"
Range("S6").Select
ActiveCell.FormulaR1C1 = "Notes"
Range("T6").Select
ActiveCell.FormulaR1C1 = "Request"
Range("U6").Select
ActiveCell.FormulaR1C1 = "Age (Days)"
Range("V6").Select
ActiveCell.FormulaR1C1 = "Age category"
Range("W6").Select
ActiveCell.FormulaR1C1 = "Rqst no"
Range("X4").Select
Range(Selection, Selection.End(xlToLeft)).S
Selection.ClearContents
Range("A5").Select
Sheets("BY YEAR").Select
Range("I8").Select
Sheets("COUPONS RAW DATA").Select
Range("D43").Select
ActiveWindow.SelectedSheet
Sheets("BY YEAR").Select
Range("G12").Select
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade!
When you call this macro you are on a certain sheet, let's call it 'x'. When you unhide a different sheet, let's call it 'y', all the macro does is unhide 'y', but the active sheet is still 'x'. So the way your macro is written, it will only add your headings and what not on the active sheet. That's why the sheet being unhid, 'y', needs to get activated first, so that the changes will be made on that sheet ('y').
When you call this macro you are on a certain sheet, let's call it 'x'. When you unhide a different sheet, let's call it 'y', all the macro does is unhide 'y', but the active sheet is still 'x'. So the way your macro is written, it will only add your headings and what not on the active sheet. That's why the sheet being unhid, 'y', needs to get activated first, so that the changes will be made on that sheet ('y').
ASKER
I understand, thanks again.
Seamus
Seamus
ASKER
Thank you very much Broomee9.
Out of interest. What is the reason it faisl to call w/o that line?