Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Want row to stay hidden

I run the following macro to fax a ride list:

Sub FaxIt()
Dim CurPrinter As String
Range("Names").AutoFilter Field:=1, Criteria1:="<"
CurPrinter = Application.ActivePrinter
ActiveWorkbook.PrintOut , ActivePrinter:="Brother PC-FAX on BMFC:"
Range("Names").AutoFilter
Application.ActivePrinter = CurPrinter
End Sub

There are times when I want to exclude a rider or two temporarily by hiding
its row prior to faxing. I do this manually with Format | Row | Hide, but
the macro unhides it.

How can I make my chosen row(s) stay hidden?

--
David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Want row to stay hidden


It appears that your Autofilter is causing the hidden lines to b
unhidden before faxing.

A possible workaound would be to have the code check which rows ar
hidden before the autofilter is applied and then re-hide those row
just before sending the fax

--
bhofset
-----------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...fo&userid=1880
View this thread: http://www.excelforum.com/showthread.php?threadid=38177

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Want row to stay hidden

bhofsetz wrote

It appears that your Autofilter is causing the hidden lines to be
unhidden before faxing.


True

A possible workaound would be to have the code check which rows are
hidden before the autofilter is applied and then re-hide those rows
just before sending the fax.


That's what I'm seeking because I don't know how to code that.

--
David
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Want row to stay hidden

Hi David,

Perhaps something like this would work for you:

Sub Tester()
Dim Rng As Range, Rng2 As Range
Dim rCell As Range
Dim sh As Worksheet

Set sh = Sheets("Sheet1") ' <<===== Change

If Not sh.AutoFilterMode Then
Range("A1").AutoFilter ' <<===== Change?
End If

Set Rng2 = sh.AutoFilter.Range.Columns(1)

For Each rCell In Rng2.Cells
If rCell.EntireRow.Hidden Then
If Not Rng Is Nothing Then
Set Rng = Union(Rng, rCell)
Else
Set Rng = rCell
End If
End If
Next

Application.ScreenUpdating = False

'your filter code here

Rng.EntireRow.Hidden = True
Application.ScreenUpdating = True

End Sub
---
Regards,
Norman



"David" wrote in message
...
bhofsetz wrote

It appears that your Autofilter is causing the hidden lines to be
unhidden before faxing.


True

A possible workaound would be to have the code check which rows are
hidden before the autofilter is applied and then re-hide those rows
just before sending the fax.


That's what I'm seeking because I don't know how to code that.

--
David



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Want row to stay hidden

Norman Jones wrote

Hi David,

Perhaps something like this would work for you:

Sub Tester()
Dim Rng As Range, Rng2 As Range
Dim rCell As Range
Dim sh As Worksheet

Set sh = Sheets("Sheet1") ' <<===== Change

If Not sh.AutoFilterMode Then
Range("A1").AutoFilter ' <<===== Change?
End If

Set Rng2 = sh.AutoFilter.Range.Columns(1)

For Each rCell In Rng2.Cells
If rCell.EntireRow.Hidden Then
If Not Rng Is Nothing Then
Set Rng = Union(Rng, rCell)
Else
Set Rng = rCell
End If
End If
Next

Application.ScreenUpdating = False

'your filter code here

Rng.EntireRow.Hidden = True
Application.ScreenUpdating = True

End Sub
---
Regards,
Norman


Thanks Norman
I may decide to adopt that method on a future project, but for now I've
opted out of using AutoFilter altogether. Instead:

Sub FaxIt()
Dim CurPrinter As String
Range("Names").SpecialCells(xlCellTypeBlanks).Enti reRow.Hidden = True
CurPrinter = Application.ActivePrinter
ActiveWorkbook.PrintOut , ActivePrinter:="Brother PC-FAX on BMFC:"
Application.ActivePrinter = CurPrinter
Range("Names").EntireRow.Hidden = False
End Sub

This works as desired and has the added bonus that makes it unnecessary
for me to remember to unhide the rows I hid manually before faxing.

--
David
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
Some comments stay hidden even after picking show/hide all why? stevepowell Excel Discussion (Misc queries) 2 July 13th 09 08:37 PM
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Hidden rows columns won't stay hidden christie Excel Worksheet Functions 0 September 30th 08 05:44 PM
I need my Hidden Rows to stay hidden when I print the sheet. Rosaliewoo Excel Discussion (Misc queries) 2 July 20th 06 07:51 PM
Ex 2K Standard Toolbar won't stay hidden Dane Excel Discussion (Misc queries) 0 October 6th 05 11:47 PM


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