PC Review


Reply
Thread Tools Rate Thread

Alternative way to refer to a row to hide or unhide...

 
 
Darin Kramer
Guest
Posts: n/a
 
      16th Feb 2007


Hi There,

I currently have a simple VB that selects data in row 60 and 61 (see
below). Problem is that if a user adds lines (and its quite possible
that he may) the macro will not hide the correct row. Is there VB to
hide a named range...?

Kind regards

Darin

Rows("60:61").Select
Selection.EntireRow.Hidden = True

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIEphY2tzb24=?=
Guest
Posts: n/a
 
      16th Feb 2007
Select the rows you want hidden, click in the address window (upper left of
sheet where you see the cell reference). Type a name in that window to give
the selected rows a "Named Range". Then put that name in your code in place
of the rows reference. This way, when rows are added above, the named range
will remain constant.
--
Best wishes,

Jim


"Darin Kramer" wrote:

>
>
> Hi There,
>
> I currently have a simple VB that selects data in row 60 and 61 (see
> below). Problem is that if a user adds lines (and its quite possible
> that he may) the macro will not hide the correct row. Is there VB to
> hide a named range...?
>
> Kind regards
>
> Darin
>
> Rows("60:61").Select
> Selection.EntireRow.Hidden = True
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      16th Feb 2007
Assign a Named Range to the rows and use the name:



Sub demo()
Range("ready_for_hide").EntireRow.Hidden = True
End Sub




The named cells will adjust as rows are added or deleted.
--
Gary''s Student
gsnu200706


"Darin Kramer" wrote:

>
>
> Hi There,
>
> I currently have a simple VB that selects data in row 60 and 61 (see
> below). Problem is that if a user adds lines (and its quite possible
> that he may) the macro will not hide the correct row. Is there VB to
> hide a named range...?
>
> Kind regards
>
> Darin
>
> Rows("60:61").Select
> Selection.EntireRow.Hidden = True
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
Darin Kramer
Guest
Posts: n/a
 
      16th Feb 2007


Awesome!! Thanks so much!

*** Sent via Developersdex http://www.developersdex.com ***
 
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
Can this be done with HIDE - UNHIDE ? ytayta555 Microsoft Excel Programming 4 12th Jun 2009 03:37 PM
Hide/Unhide Judy F Microsoft Excel Discussion 0 24th Jun 2008 11:49 PM
hide/unhide Joanne Microsoft Excel Programming 2 23rd Jul 2007 12:36 AM
Hide - Unhide =?Utf-8?B?Qm9i?= Microsoft Excel Programming 0 16th Nov 2006 05:46 PM
Hide Unhide Colin Microsoft Excel Misc 4 9th Apr 2006 05:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:28 AM.