Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do I make a macro work in one worksheet only

I have the following macro:

ActiveSheet.Unprotect Password:="test"
Range("A10:T400").Select
Selection.Sort Key1:=Range("B10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
ActiveSheet.Protect Password:="test"

My problem is that I only want this macro to work on the worksheet titled
"Data Entry Sheet". If somebody accidentally runs it while they are working
on a different worksheet it messes up all the formulas on that worksheet. Any
and all help is greatly appreciated. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How do I make a macro work in one worksheet only

Hi Hawkfan757

Use this as first line in your macro
If ActiveSheet.Name = "Data Entry Sheet" Then Exit Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Hawkfan757" wrote in message ...
I have the following macro:

ActiveSheet.Unprotect Password:="test"
Range("A10:T400").Select
Selection.Sort Key1:=Range("B10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
ActiveSheet.Protect Password:="test"

My problem is that I only want this macro to work on the worksheet titled
"Data Entry Sheet". If somebody accidentally runs it while they are working
on a different worksheet it messes up all the formulas on that worksheet. Any
and all help is greatly appreciated. Thanks in advance.



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
make calculations work with one worksheet closed Bob L[_2_] New Users to Excel 4 March 30th 10 08:22 PM
How do I make the scroll wheel not work on a worksheet? rcomer123 Excel Worksheet Functions 1 April 18th 08 04:24 PM
Get Macro on one Worksheet to Work on Others Tom Dunlap Excel Programming 1 June 26th 04 08:43 PM
having a macro work only on a worksheet dennc01 Excel Programming 3 April 6th 04 11:05 PM
Macro to make a cell work like a check Logan[_2_] Excel Programming 2 February 3rd 04 04:11 AM


All times are GMT +1. The time now is 09:34 AM.

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"