Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default .activate on hidden sheet

I want to use the code below from a userform to perform the actions on a
hidden sheet. I get an error message becuase the sheet is hidden. How can I
re-write this code and not use the range.activate or range.select method?
--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default .activate on hidden sheet

Have your code:

1. un-hide the sheet
2. do its thing
3. re-hide the sheet
--
Gary''s Student - gsnu200730
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default .activate on hidden sheet

Depending on what you're doing, you can work directly on that worksheet:

dim HWks as worksheet
set Hwks = worksheets("hiddensheetnamehere")
hwks.range("a1").value = "hi there"

But maybe more info about what you want to do would be better.



Shawn wrote:

I want to use the code below from a userform to perform the actions on a
hidden sheet. I get an error message becuase the sheet is hidden. How can I
re-write this code and not use the range.activate or range.select method?
--
Thanks
Shawn


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default .activate on hidden sheet

I would rather not unhide the sheet. I forgot to paste the code. Here is my
code

WSSD.Range("A10").End(xlDown).Activate
Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-2, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-3, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-4, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-5, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-6, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-7, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-8, 0).Value Then
ActiveCell.Value = ""
ActiveCell.Offset(-1, 0).Activate
Loop

--
Thanks
Shawn


"Dave Peterson" wrote:

Depending on what you're doing, you can work directly on that worksheet:

dim HWks as worksheet
set Hwks = worksheets("hiddensheetnamehere")
hwks.range("a1").value = "hi there"

But maybe more info about what you want to do would be better.



Shawn wrote:

I want to use the code below from a userform to perform the actions on a
hidden sheet. I get an error message becuase the sheet is hidden. How can I
re-write this code and not use the range.activate or range.select method?
--
Thanks
Shawn


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default .activate on hidden sheet

Try something like this:

Dim rng as Range, rng1 as Range, i as Long
With WSSD
set rng = .Range(.Cells(10,1),.Cells(10,1).End(xldown))

for i = rng(rng.count).row to 10 step -1
rng1 = .cells(i - 8,1).Resize(8,1)
if application.countif(rng1,.Cells(i,1)) 0 then
.cells(i,1).ClearContents
end if
Next
End With

--
Regards,
Tom Ogilvy


"Shawn" wrote:

I would rather not unhide the sheet. I forgot to paste the code. Here is my
code

WSSD.Range("A10").End(xlDown).Activate
Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-2, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-3, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-4, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-5, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-6, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-7, 0).Value Or _
ActiveCell.Value = ActiveCell.Offset(-8, 0).Value Then
ActiveCell.Value = ""
ActiveCell.Offset(-1, 0).Activate
Loop

--
Thanks
Shawn


"Dave Peterson" wrote:

Depending on what you're doing, you can work directly on that worksheet:

dim HWks as worksheet
set Hwks = worksheets("hiddensheetnamehere")
hwks.range("a1").value = "hi there"

But maybe more info about what you want to do would be better.



Shawn wrote:

I want to use the code below from a userform to perform the actions on a
hidden sheet. I get an error message becuase the sheet is hidden. How can I
re-write this code and not use the range.activate or range.select method?
--
Thanks
Shawn


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default .activate on hidden sheet

See error below



Dim rng as Range, rng1 as Range, i as Long
With WSSD
set rng = .Range(.Cells(10,1),.Cells(10,1).End(xldown))

for i = rng(rng.count).row to 10 step -1
rng1 = .cells(i - 8,1).Resize(8,1) <<<< runtime error 91 right here
if application.countif(rng1,.Cells(i,1)) 0 then
.cells(i,1).ClearContents
end if
Next
End With



--
Thanks
Shawn

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default .activate on hidden sheet

Try:

Set rng1 = .Cells(i - 8, 1).Resize(8, 1)

in place of that troublesome line.

Shawn wrote:

See error below

Dim rng as Range, rng1 as Range, i as Long
With WSSD
set rng = .Range(.Cells(10,1),.Cells(10,1).End(xldown))

for i = rng(rng.count).row to 10 step -1
rng1 = .cells(i - 8,1).Resize(8,1) <<<< runtime error 91 right here
if application.countif(rng1,.Cells(i,1)) 0 then
.cells(i,1).ClearContents
end if
Next
End With


--
Thanks
Shawn


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .activate on hidden sheet

You can always:

Application.screenupdating = false
..
..
Do your thing
..
..
Application.screenupdating = true




On 6/17/07 4:58 AM, in article
, "Shawn"
wrote:

I want to use the code below from a userform to perform the actions on a
hidden sheet. I get an error message becuase the sheet is hidden. How can I
re-write this code and not use the range.activate or range.select method?


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
Activate the top of sheet AD108 Excel Worksheet Functions 2 July 30th 06 05:27 PM
I need my Hidden Rows to stay hidden when I print the sheet. Rosaliewoo Excel Discussion (Misc queries) 2 July 20th 06 07:51 PM
sheet.activate nk Excel Programming 0 April 8th 05 05:04 PM
Return to Current Sheet in On (sheet activate) event macro Paul Moles Excel Programming 1 March 27th 05 03:16 PM
Saving hidden data with a worksheet (preferably without using a hidden sheet) Dick Kusleika[_3_] Excel Programming 2 January 21st 04 04:39 PM


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