Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
Hello Everyone,
Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
Try this
Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Move Befo=.Worksheets(1) .Save End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... Hello Everyone, Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
I Tried this. It didnt work...I dont know what I am doing wrong
this what I inputed: Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Solution Direct Tracking").Move Befo=.Worksheets(1) .Save End With End Sub Tanisha "Bob Phillips" wrote: Try this Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Move Befo=.Worksheets(1) .Save End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... Hello Everyone, Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
Did you put it where directed?
What did you get? -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... I Tried this. It didnt work...I dont know what I am doing wrong this what I inputed: Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Solution Direct Tracking").Move Befo=.Worksheets(1) .Save End With End Sub Tanisha "Bob Phillips" wrote: Try this Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Move Befo=.Worksheets(1) .Save End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... Hello Everyone, Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
Bob ...Thanks for all your help....I figured out my mistake......IT WORKS!
Thanks again "Bob Phillips" wrote: Did you put it where directed? What did you get? -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... I Tried this. It didnt work...I dont know what I am doing wrong this what I inputed: Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Solution Direct Tracking").Move Befo=.Worksheets(1) .Save End With End Sub Tanisha "Bob Phillips" wrote: Try this Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Move Befo=.Worksheets(1) .Save End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tanisha" wrote in message ... Hello Everyone, Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
I need a Macro for Sorting workshhets
I think I would put this kind of code into the workbook_open event.
If someone opens the workbook, makes drastic changes, then tries to close, your code will Save the workbook. This may not be what the user intended. If you put this kind of code in the workbook_open event, that sheet will be where you want when the user opens the file--and there's no worry about saving stuff that shouldn't be saved. Just a thought. Tanisha wrote: Hello Everyone, Can some one please assist me in writing a code to move one "named" worksheet to the begining of a workbook and I would like for this Macro to Auto Run when the workbook is closed? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why paste between workshhets yields values only | Excel Discussion (Misc queries) | |||
how can i merge two workshhets in to one? | New Users to Excel | |||
Formula to copy text from a column in different workshhets | Excel Worksheet Functions | |||
sum between workshhets | Excel Discussion (Misc queries) | |||
merge/combine workshhets | Excel Discussion (Misc queries) |