Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to hide row range from code?

Hello,

I use VB in Excel.
I want to hide part of Worksheet from row X to row Y.
X and Y should be integers marking rows where specific cell values (string
constants) were found.

In Excel VBA Help for me this is not clear enough. For example, how to
manipulate rows and their properties, it is only "range" and "cells".

Can someone give me an example?

Regards,
Vladimir






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default How to hide row range from code?

Maybe this will help a little:

Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 12
Rows(StartRow & ":" & EndRow).Hidden = True


--
Jim Rech
Excel MVP


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to hide row range from code?

Vladimir,

Try something like the following:


Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 19
ActiveSheet.Rows(StartRow).Resize(EndRow - StartRow + 1).EntireRow.Hidden =
True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Majstor" wrote in message
...
Hello,

I use VB in Excel.
I want to hide part of Worksheet from row X to row Y.
X and Y should be integers marking rows where specific cell values (string
constants) were found.

In Excel VBA Help for me this is not clear enough. For example, how to
manipulate rows and their properties, it is only "range" and "cells".

Can someone give me an example?

Regards,
Vladimir








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to hide row range from code?

Vladimir. Here's a start.

Sub HideRows()
Dim X As Integer, Y As Integer

X = Cells(1, 1).Value
Y = Cells(2, 1).Value
If X < 1 Or Y < 1 Then Exit Sub

Rows("" & X & ":" & Y & "").Hidden = True

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hello,

I use VB in Excel.
I want to hide part of Worksheet from row X to row Y.
X and Y should be integers marking rows where specific cell values (string
constants) were found.

In Excel VBA Help for me this is not clear enough. For example, how to
manipulate rows and their properties, it is only "range" and "cells".

Can someone give me an example?

Regards,
Vladimir






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to hide row range from code?

X and Y are in fact ordinal numbers of rows where specific string values S1
and S2 occur !
Let`s say that I find those rows with ".Find". How to return ordinal number
of row?

Vladimir

wrote in message
...
Vladimir. Here's a start.

Sub HideRows()
Dim X As Integer, Y As Integer

X = Cells(1, 1).Value
Y = Cells(2, 1).Value
If X < 1 Or Y < 1 Then Exit Sub

Rows("" & X & ":" & Y & "").Hidden = True

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------

------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------

------------------------------------

Hello,

I use VB in Excel.
I want to hide part of Worksheet from row X to row Y.
X and Y should be integers marking rows where specific cell values

(string
constants) were found.

In Excel VBA Help for me this is not clear enough. For example, how to
manipulate rows and their properties, it is only "range" and "cells".

Can someone give me an example?

Regards,
Vladimir










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to hide row range from code?

X and Y are in fact ordinal numbers of rows where specific string values S1
and S2 occur !
Let`s say that I find those rows with ".Find". How to return ordinal number
of row?

Vladimir

"Chip Pearson" wrote in message
...
Vladimir,

Try something like the following:


Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 19
ActiveSheet.Rows(StartRow).Resize(EndRow - StartRow + 1).EntireRow.Hidden

=
True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Majstor" wrote in message
...
Hello,

I use VB in Excel.
I want to hide part of Worksheet from row X to row Y.
X and Y should be integers marking rows where specific cell values

(string
constants) were found.

In Excel VBA Help for me this is not clear enough. For example, how to
manipulate rows and their properties, it is only "range" and "cells".

Can someone give me an example?

Regards,
Vladimir










  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How to hide row range from code?

Jim this seems to solve half of my problem! If I am using
the toggle button, what would the code be to allow the
first click to unhide the rows and then the second click
to hide the rows. The code below hides.

Janice
-----Original Message-----
Maybe this will help a little:

Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 12
Rows(StartRow & ":" & EndRow).Hidden = True


--
Jim Rech
Excel MVP


.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to hide row range from code?

Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 12
Rows(StartRow & ":" & EndRow).Hidden = _
Not Rows(StartRow).Hidden

--
Regards,
Tom Ogilvy

wrote in message
...
Jim this seems to solve half of my problem! If I am using
the toggle button, what would the code be to allow the
first click to unhide the rows and then the second click
to hide the rows. The code below hides.

Janice
-----Original Message-----
Maybe this will help a little:

Dim StartRow As Long
Dim EndRow As Long
StartRow = 10
EndRow = 12
Rows(StartRow & ":" & EndRow).Hidden = True


--
Jim Rech
Excel MVP


.



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 row code help Jeremy Excel Discussion (Misc queries) 1 January 5th 10 06:23 PM
Hide Code Stockwell43 Excel Discussion (Misc queries) 3 January 12th 09 07:05 PM
hide code does not hide Wanna Learn Excel Discussion (Misc queries) 2 March 6th 08 07:21 PM
Hide VBA code help GerryK Excel Worksheet Functions 3 May 30th 07 09:47 PM
Hide Code tannersnonni Excel Discussion (Misc queries) 0 July 28th 05 01:06 AM


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