Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Alternative way to refer to a row to hide or unhide...



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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Alternative way to refer to a row to hide or unhide...

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 ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Alternative way to refer to a row to hide or unhide...

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 ***

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Alternative way to refer to a row to hide or unhide...



Awesome!! Thanks so much!

*** Sent via Developersdex http://www.developersdex.com ***
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
Hide/Unhide row VBA Scafidel[_2_] Excel Discussion (Misc queries) 1 March 23rd 09 05:28 PM
hide/unhide brownti Excel Discussion (Misc queries) 3 February 6th 07 07:14 PM
Hide Unhide Colin Excel Discussion (Misc queries) 4 April 9th 06 05:01 PM
Hide/unhide Jock W Excel Worksheet Functions 4 October 4th 05 05:02 PM
hide/unhide heartbreakkid Excel Programming 6 May 7th 04 10:13 PM


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