Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Disable moving sheets

Hi All,

I wondered if there is a method to disable the moving of sheets other
than protecting the workbook structure.

Any code to achieve this would be gratefully appreciated

TIA

Michael B

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Disable moving sheets

Protecting the structure is the only direct method to control this. Using
code is simply defeated by disabling macros. In fact, if security is set to
high and the macro is not certified and accepted by the user, then the macros
would be disabled without the user even knowing it existed.

there is no trappable event directly related to moving a worksheet.

--
Regards,
Tom Ogilvy




"michael.beckinsale" wrote:

Hi All,

I wondered if there is a method to disable the moving of sheets other
than protecting the workbook structure.

Any code to achieve this would be gratefully appreciated

TIA

Michael B


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Disable moving sheets


Private Sub SetSheetOrder()
'Check Sheet Order
Application.ScreenUpdating = False
If Worksheets("Sheet2").Index = 1 Then
If Worksheets("Sheet1").Index = 2 Then
If Worksheets("Sheet3").Index = 3 Then Exit Sub
End If
End If

'Re-Order Sheets
Worksheets("Sheet2").Move befo=Sheets(1)
Worksheets("Sheet1").Move after:=Sheets(1)
Worksheets("Sheet3").Move after:=Sheets(2)
End Sub

You could add as many layers as you want. If you need to make sure
that they never change the sheets, run this sub in the
Worksheet_Deactivate() sub of each sheet. If you just need to
determine the sheet order before you run some of your own macros, you
only need the Re-Order Sheets portion of the sub and you don't need to
put it in each sheets Worksheet_Deactivate sub.

On Aug 23, 8:08 am, "michael.beckinsale"
wrote:
Hi All,

I wondered if there is a method to disable the moving of sheets other
than protecting the workbook structure.

Any code to achieve this would be gratefully appreciated

TIA

Michael B



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Disable moving sheets

Hi Don,

Many thanks for the code. It isn't quite what l want but l can adapt
the concept to give me what l want.

I wasn't aware of the .Index method

Regards

Michael B

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Disable moving sheets

On Aug 24, 3:06 am, "michael.beckinsale"
wrote:
Hi Don,

Many thanks for the code. It isn't quite what l want but l can adapt
the concept to give me what l want.

I wasn't aware of the .Index method

Regards

Michael B


I never had an formal Excel training or education so there is probably
a better way... Enjoy!



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
linked sheets,why do they disable ? coltheplumb Excel Discussion (Misc queries) 0 November 23rd 09 08:31 PM
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Moving Between Sheets PaolaAndrea Excel Discussion (Misc queries) 1 December 2nd 08 05:15 PM
disable unhide sheets on toolbar ditchy Excel Discussion (Misc queries) 8 May 4th 05 10:10 AM
moving between sheets aschneid Excel Programming 2 May 11th 04 10:07 AM


All times are GMT +1. The time now is 10:46 AM.

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

About Us

"It's about Microsoft Excel"