Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why paste between workshhets yields values only CGCPA Excel Discussion (Misc queries) 6 December 11th 08 03:36 PM
how can i merge two workshhets in to one? mahesh fulani New Users to Excel 2 January 23rd 06 08:06 PM
Formula to copy text from a column in different workshhets TheTomo Excel Worksheet Functions 2 January 13th 06 04:09 PM
sum between workshhets OZDOC1050 Excel Discussion (Misc queries) 2 August 9th 05 12:04 PM
merge/combine workshhets Jeff224 Excel Discussion (Misc queries) 3 March 17th 05 03:54 PM


All times are GMT +1. The time now is 06:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"