PC Review


Reply
Thread Tools Rate Thread

.activate on hidden sheet

 
 
=?Utf-8?B?U2hhd24=?=
Guest
Posts: n/a
 
      17th Jun 2007
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      17th Jun 2007
Have your code:

1. un-hide the sheet
2. do its thing
3. re-hide the sheet
--
Gary''s Student - gsnu200730
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      17th Jun 2007
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
 
Reply With Quote
 
=?Utf-8?B?U2hhd24=?=
Guest
Posts: n/a
 
      17th Jun 2007
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
>

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

 
Reply With Quote
 
=?Utf-8?B?U2hhd24=?=
Guest
Posts: n/a
 
      18th Jun 2007
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

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      18th Jun 2007
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
 
Reply With Quote
 
Brett Jones
Guest
Posts: n/a
 
      2nd Jul 2007
You can always:

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




On 6/17/07 4:58 AM, in article
418FEDD4-7396-407A-8395-(E-Mail Removed), "Shawn"
<(E-Mail Removed)> 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 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
What is the difference between 'Select' a sheet and 'Activate' a sheet RJQMAN Microsoft Excel Programming 9 30th Oct 2010 05:22 AM
I need my Hidden Rows to stay hidden when I print the sheet. =?Utf-8?B?Um9zYWxpZXdvbw==?= Microsoft Excel Misc 2 20th Jul 2006 07:51 PM
Return to Current Sheet in On (sheet activate) event macro =?Utf-8?B?UGF1bCBNb2xlcw==?= Microsoft Excel Programming 1 27th Mar 2005 03:16 PM
Saving hidden data with a worksheet (preferably without using a hidden sheet) Aaron Queenan Microsoft Excel Programming 3 21st Jan 2004 04:39 PM
Why wouldn't calling the Activate sub for a sheet automatically call that sheet's Worksheet_Activate() sub? Scott Lyon Microsoft Excel Programming 3 19th Aug 2003 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:04 PM.