Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I enable a macro to run in a hidden worksheet?

It presently runs only when unhidden. Conversely, If I could protect the
worksheet from user changes (but still allow the macro to operate in this
individual worksheet) it would accomplish the same goal. The macro sorts data
independently in each column. The name of the sheet is "sort".
Thank You.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default How can I enable a macro to run in a hidden worksheet?

Unhide the sheet! This may give you some ideas of how ot get started:
http://excel.tips.net/Pages/T002548_...orksheets.html

http://www.teachexcel.com/macros/del...worksheets.php

http://stackoverflow.com/questions/8...s-or-workbooks


HTH,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"curtc" wrote:

It presently runs only when unhidden. Conversely, If I could protect the
worksheet from user changes (but still allow the macro to operate in this
individual worksheet) it would accomplish the same goal. The macro sorts data
independently in each column. The name of the sheet is "sort".
Thank You.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How can I enable a macro to run in a hidden worksheet?

My bet is that you're selecting ranges on that hidden sheet. And you can only
select a range if that sheet is active. And those hidden sheets will never be
active.

So you could save where the user is, unhide the sheet, select the sheet, select
the range to sort, hide the sheet, and go back to where the user started.

And if you hide your actions with:
application.screenupdating = false
'lots of code here
application.screenupdating = true

But better is to drop the .select's from your code.

Dim RngToSort as range

with worksheets("sort")
'this sorts Column A:X from row 1 to the last row used in column A
'you didn't share what you were sorting!
set rngtosort = .range("A1:X" & .cells(.rows.count,"A").end(xlup).row)
end with

with rngtosort
.Cells.Sort key1:=.Columns(1), Order1:=xlDescending, _
Key2:=.Columns(3), Order2:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
End With
'this sorted by column 1 (descending) and then column 3 (ascending).
'you didn't share how you were sorting!



curtc wrote:

It presently runs only when unhidden. Conversely, If I could protect the
worksheet from user changes (but still allow the macro to operate in this
individual worksheet) it would accomplish the same goal. The macro sorts data
independently in each column. The name of the sheet is "sort".
Thank You.


--

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
enable re-code to re-read on re-hidden columns, if can be possible driller Excel Discussion (Misc queries) 6 October 11th 09 12:52 PM
Macro running against hidden worksheet George Excel Discussion (Misc queries) 1 July 23rd 07 09:42 PM
Macro needs data from hidden worksheet [email protected] Excel Programming 3 September 8th 06 06:52 AM
macro to hidden worksheet murph306 Excel Discussion (Misc queries) 8 June 1st 06 02:35 PM
Macro to enable or visible on specific worksheet only Edgar Excel Programming 4 May 31st 04 07:26 AM


All times are GMT +1. The time now is 01: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"