PC Review


Reply
Thread Tools Rate Thread

Disable moving sheets

 
 
michael.beckinsale
Guest
Posts: n/a
 
      23rd Aug 2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      23rd Aug 2007
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
>
>

 
Reply With Quote
 
Don
Guest
Posts: n/a
 
      23rd Aug 2007

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 before:=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"
<michael.beckins...@ntlworld.com> 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



 
Reply With Quote
 
michael.beckinsale
Guest
Posts: n/a
 
      24th Aug 2007
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

 
Reply With Quote
 
Don
Guest
Posts: n/a
 
      24th Aug 2007
On Aug 24, 3:06 am, "michael.beckinsale"
<michael.beckins...@ntlworld.com> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted Microsoft ASP .NET 0 6th Jan 2008 04:45 AM
Moving sheets =?Utf-8?B?YWZmb3Jkc29s?= Microsoft Excel Programming 3 17th Mar 2006 07:29 AM
Moving through sheets =?Utf-8?B?aXpsb3Bleg==?= Microsoft Excel Misc 1 13th Jan 2005 08:33 PM
Moving through sheets Keith Emery Microsoft Excel Programming 2 22nd Jun 2004 01:53 PM
Moving between sheets aschneid Microsoft Excel Misc 2 12th May 2004 12:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:48 AM.