Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide rows with macro


I have a question about hiding and unhiding rows with a Macro. I hav
searched trough the forum but I couldn't find the right solution for m
specific problem.

The situation is as follows:

I have a sheet that I want to make a bit smaller, by hiding rows. Th
amount of visible rows can be entered in cell F7. The rows that shoul
be hidden are rows 14 till 25.

So if the number of visible rows entered in cell F7 is 1, row 1
unhides, if it's 2 row 14&15 unhide etc.

Is there a way to do this in a Macro?

Many thanks in advance for your help.

ps. I'm sorry for any grammar or spelling mistakes, English is not m
mother language :

--
Fugaz
-----------------------------------------------------------------------
Fugazy's Profile: http://www.excelforum.com/member.php...fo&userid=3517
View this thread: http://www.excelforum.com/showthread.php?threadid=54947

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Hide rows with macro

rows(14).Resize(Range("F7")).EntireRow.Hidden = False

--
Regards,
Tom Ogilvy


"Fugazy" wrote:


I have a question about hiding and unhiding rows with a Macro. I have
searched trough the forum but I couldn't find the right solution for my
specific problem.

The situation is as follows:

I have a sheet that I want to make a bit smaller, by hiding rows. The
amount of visible rows can be entered in cell F7. The rows that should
be hidden are rows 14 till 25.

So if the number of visible rows entered in cell F7 is 1, row 14
unhides, if it's 2 row 14&15 unhide etc.

Is there a way to do this in a Macro?

Many thanks in advance for your help.

ps. I'm sorry for any grammar or spelling mistakes, English is not my
mother language :)


--
Fugazy
------------------------------------------------------------------------
Fugazy's Profile: http://www.excelforum.com/member.php...o&userid=35179
View this thread: http://www.excelforum.com/showthread...hreadid=549471


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide rows with macro


Wow, thanks for the swift and good replies!

It worked ;

--
Fugaz
-----------------------------------------------------------------------
Fugazy's Profile: http://www.excelforum.com/member.php...fo&userid=3517
View this thread: http://www.excelforum.com/showthread.php?threadid=54947

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Hide rows with macro

Paste the following code in your Worksheet's code
(right-click tab, select View code)

HTH
--
AP

'----------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rNbRow As Range
Dim lrow As Long

Set rNbRow = Range("F7")
If Intersect(Target, rNbRow) Is Nothing Then Exit Sub
For lrow = 14 To 25
Rows(lrow).Hidden = lrow = rNbRow.Value + 14
Next lrow

End Sub
'------------------------------------------------------------
"Fugazy" a écrit dans
le message de news: ...

I have a question about hiding and unhiding rows with a Macro. I have
searched trough the forum but I couldn't find the right solution for my
specific problem.

The situation is as follows:

I have a sheet that I want to make a bit smaller, by hiding rows. The
amount of visible rows can be entered in cell F7. The rows that should
be hidden are rows 14 till 25.

So if the number of visible rows entered in cell F7 is 1, row 14
unhides, if it's 2 row 14&15 unhide etc.

Is there a way to do this in a Macro?

Many thanks in advance for your help.

ps. I'm sorry for any grammar or spelling mistakes, English is not my
mother language :)


--
Fugazy
------------------------------------------------------------------------
Fugazy's Profile:
http://www.excelforum.com/member.php...o&userid=35179
View this thread: http://www.excelforum.com/showthread...hreadid=549471





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
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Macro to hide rows Alex Excel Programming 1 November 7th 05 07:09 PM
hide rows with macro Alen32 Excel Programming 8 May 27th 05 01:40 PM
hide rows with macro Macro to hide rows in spreadwsheet Excel Discussion (Misc queries) 3 May 12th 05 05:02 PM
macro to hide rows david Excel Discussion (Misc queries) 3 April 8th 05 03:25 PM


All times are GMT +1. The time now is 09:20 PM.

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"