Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati


I wish for this macro to hide every rows whch contains "info" in colum
B, but when I push the button associated with it, all rows become
hidden. Any1 can help me with this?


ActiveSheet.Columns("B").Select
Selection.AutoFilter Field:=1, Criteria1:="info"
Selection.EntireRow.Hidden = Tru

--
Turquoise_da
-----------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...fo&userid=3518
View this thread: http://www.excelforum.com/showthread.php?threadid=55366

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati

The rows that are filtered are still selected. Therefore when you hide
selection you hide everything. Try this:

Sub HideRows
Dim cell as range
for each cell in Range("B:B")
if cell = "info" then Rows(cell.row).Hidden = True
next
end sub

HTH

Die_Another_Day

Turquoise_dax wrote:
I wish for this macro to hide every rows whch contains "info" in column
B, but when I push the button associated with it, all rows becomes
hidden. Any1 can help me with this?


ActiveSheet.Columns("B").Select
Selection.AutoFilter Field:=1, Criteria1:="info"
Selection.EntireRow.Hidden = True


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=553660


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati


This works fine to hide. However, I also have a "show all" button and i
does not work after. Here is the (very short) code:

Rows("1:100").Select
Selection.EntireRow.Hidden = False

When clicking, it does not unhide rows previously hidden (and in th
range 1-100

--
Turquoise_da
-----------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...fo&userid=3518
View this thread: http://www.excelforum.com/showthread.php?threadid=55366

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati

I'm not sure why that doesn't work. This seems to work for me:
Rows("1:100").Hidden = False

HTH

Die_Another_Day

Turquoise_dax wrote:
This works fine to hide. However, I also have a "show all" button and it
does not work after. Here is the (very short) code:

Rows("1:100").Select
Selection.EntireRow.Hidden = False

When clicking, it does not unhide rows previously hidden (and in the
range 1-100)


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=553660


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati


The row number are now all blue. What does it mean, and could it be
indicative of the problem?


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=553660



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati

I think that means autoFiltering is still turned on.

Die_Another_Day
Turquoise_dax wrote:
The row number are now all blue. What does it mean, and could it be
indicative of the problem?


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=553660


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
What is wrong with this line? ChartsToBe Charts and Charting in Excel 0 July 28th 06 12:08 AM
what's wrong with this paste line?? Tre_cool[_8_] Excel Programming 3 September 18th 05 12:45 AM
Something wrong in one line of VBA code Daniel Bonallack Excel Programming 6 June 29th 05 07:23 PM
Whats wrong with this line of code? Edgar Thoemmes[_4_] Excel Programming 4 October 26th 04 12:52 PM
What's wrong with this line of code? Sandy[_3_] Excel Programming 0 July 23rd 03 12:15 PM


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