If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Macro
I have created a macro in a workbook that has multiply
worksheets (tabs). The macro works great on the worksheet where the macro was created. However, when I move to a different "tab", the macro goes back to tab where is was created and runs the macro. I want to create/change my macro to a "universal" marco, where I can go to any "tab" and the macro will function properly. To follow is the script for my macro. Thanks for any help. Sub quickfix() ' ' quickfix Macro ' Macro recorded 9/15/2003 by nnoonchester ' ' Keyboard Shortcut: Ctrl+u ' Sheets("Chandler, Darrell (2)").Select Columns("D:E").Select Range("D4").Activate Selection.Copy Sheets("Sheet1 (126)").Select Columns("D").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Columns("H:H").Select Range("H4").Activate Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Columns("H:H").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Range("F9:G48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("F9").Select ActiveSheet.Paste Sheets("Chandler, Darrell (2)").Select Range("I10:I48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("I10").Select ActiveSheet.Paste Columns("D").Select Selection.EntireColumn.Hidden = True Range("A3").Select End Sub |
#2
|
|||
|
|||
Macro
Your macro is in particular sheet. Move it to a module. If
you don't have a module in your VBA project, click your VBA project and a insert a module. -----Original Message----- I have created a macro in a workbook that has multiply worksheets (tabs). The macro works great on the worksheet where the macro was created. However, when I move to a different "tab", the macro goes back to tab where is was created and runs the macro. I want to create/change my macro to a "universal" marco, where I can go to any "tab" and the macro will function properly. To follow is the script for my macro. Thanks for any help. Sub quickfix() ' ' quickfix Macro ' Macro recorded 9/15/2003 by nnoonchester ' ' Keyboard Shortcut: Ctrl+u ' Sheets("Chandler, Darrell (2)").Select Columns("D:E").Select Range("D4").Activate Selection.Copy Sheets("Sheet1 (126)").Select Columns("D").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Columns("H:H").Select Range("H4").Activate Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Columns("H:H").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Range("F9:G48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("F9").Select ActiveSheet.Paste Sheets("Chandler, Darrell (2)").Select Range("I10:I48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("I10").Select ActiveSheet.Paste Columns("D").Select Selection.EntireColumn.Hidden = True Range("A3").Select End Sub . |
#3
|
|||
|
|||
Macro
I do have a module. How do I move the macro and is that
all that is needed? Sorry to sound stupid, I learned Macros the old long way and in Lotus. Thanks. -----Original Message----- Your macro is in particular sheet. Move it to a module. If you don't have a module in your VBA project, click your VBA project and a insert a module. -----Original Message----- I have created a macro in a workbook that has multiply worksheets (tabs). The macro works great on the worksheet where the macro was created. However, when I move to a different "tab", the macro goes back to tab where is was created and runs the macro. I want to create/change my macro to a "universal" marco, where I can go to any "tab" and the macro will function properly. To follow is the script for my macro. Thanks for any help. Sub quickfix() ' ' quickfix Macro ' Macro recorded 9/15/2003 by nnoonchester ' ' Keyboard Shortcut: Ctrl+u ' Sheets("Chandler, Darrell (2)").Select Columns("D:E").Select Range("D4").Activate Selection.Copy Sheets("Sheet1 (126)").Select Columns("D").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Columns("H:H").Select Range("H4").Activate Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Columns("H:H").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Range("F9:G48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("F9").Select ActiveSheet.Paste Sheets("Chandler, Darrell (2)").Select Range("I10:I48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("I10").Select ActiveSheet.Paste Columns("D").Select Selection.EntireColumn.Hidden = True Range("A3").Select End Sub . . |
#4
|
|||
|
|||
Macro
Yes, that is all. Cut your current macro and paste it in
the module. -----Original Message----- I do have a module. How do I move the macro and is that all that is needed? Sorry to sound stupid, I learned Macros the old long way and in Lotus. Thanks. -----Original Message----- Your macro is in particular sheet. Move it to a module. If you don't have a module in your VBA project, click your VBA project and a insert a module. -----Original Message----- I have created a macro in a workbook that has multiply worksheets (tabs). The macro works great on the worksheet where the macro was created. However, when I move to a different "tab", the macro goes back to tab where is was created and runs the macro. I want to create/change my macro to a "universal" marco, where I can go to any "tab" and the macro will function properly. To follow is the script for my macro. Thanks for any help. Sub quickfix() ' ' quickfix Macro ' Macro recorded 9/15/2003 by nnoonchester ' ' Keyboard Shortcut: Ctrl+u ' Sheets("Chandler, Darrell (2)").Select Columns("D:E").Select Range("D4").Activate Selection.Copy Sheets("Sheet1 (126)").Select Columns("D").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Columns("H:H").Select Range("H4").Activate Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Columns("H:H").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Range("F9:G48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("F9").Select ActiveSheet.Paste Sheets("Chandler, Darrell (2)").Select Range("I10:I48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("I10").Select ActiveSheet.Paste Columns("D").Select Selection.EntireColumn.Hidden = True Range("A3").Select End Sub . . . |
#5
|
|||
|
|||
Macro
Nicole,
Remove the line "Sheets("Chandler, Darrell (2)").Select". This is what is causing you grief. This line forces the macro to return to the Chandler..... (2) Sheet Steve "Nicole" wrote in message ... I have created a macro in a workbook that has multiply worksheets (tabs). The macro works great on the worksheet where the macro was created. However, when I move to a different "tab", the macro goes back to tab where is was created and runs the macro. I want to create/change my macro to a "universal" marco, where I can go to any "tab" and the macro will function properly. To follow is the script for my macro. Thanks for any help. Sub quickfix() ' ' quickfix Macro ' Macro recorded 9/15/2003 by nnoonchester ' ' Keyboard Shortcut: Ctrl+u ' Sheets("Chandler, Darrell (2)").Select Columns("D:E").Select Range("D4").Activate Selection.Copy Sheets("Sheet1 (126)").Select Columns("D").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Columns("H:H").Select Range("H4").Activate Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Columns("H:H").Select Selection.Insert Shift:=xlToRight Sheets("Chandler, Darrell (2)").Select Range("F9:G48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("F9").Select ActiveSheet.Paste Sheets("Chandler, Darrell (2)").Select Range("I10:I48").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1 (126)").Select Range("I10").Select ActiveSheet.Paste Columns("D").Select Selection.EntireColumn.Hidden = True Range("A3").Select End Sub |
Thread Tools | |
Display Modes | |
|
|