Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Selecting two ranges of unadjacent cells

Problem:
I have a list of all the dates in the year. I want to hide all of the dates that are not May. I want to hide all the dates before and after May. How do I hide all the dates except May using a macro in VB.

Note: Specific cells cant be hidden, because the position of the dates in May might change. I can make a For...Next loop that does this, but it hides each row one by one, and takes tooooooo long.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting two ranges of unadjacent cells

Turn on the macro recorder and apply an autofilter to your data
(data=Filter=Autofilter). In the column with the dates select custom and
choose greater than May 30, 2004 OR earlier than May 1, 2004. If you want
May over multiple years, then use a helper column and put a formula in that
returns the number of the month, then filter on that.

Turn off the macro recorder and generalize the code if you wish/need to.

--
Regards,
Tom Ogilvy

"CTInt04" wrote in message
...
Problem:
I have a list of all the dates in the year. I want to hide all of the

dates that are not May. I want to hide all the dates before and after May.
How do I hide all the dates except May using a macro in VB.

Note: Specific cells cant be hidden, because the position of the dates in

May might change. I can make a For...Next loop that does this, but it hides
each row one by one, and takes tooooooo long.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting two ranges of unadjacent cells

Show us the code that takes to long.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CTInt04" wrote in message
...
Problem:
I have a list of all the dates in the year. I want to hide all of the

dates that are not May. I want to hide all the dates before and after May.
How do I hide all the dates except May using a macro in VB.

Note: Specific cells cant be hidden, because the position of the dates in

May might change. I can make a For...Next loop that does this, but it hides
each row one by one, and takes tooooooo long.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Selecting two ranges of unadjacent cells

Do you want to hide all rows with any month besides May in a given
column? select the range, and select Autofilter on the Data menu. Click
on the dropdown arrow atop the Month column, select May, and all other
rows disappear.

Do you want cells containing other months to appear empty? Use
conditional formatting, make the condition Cell Value - Is Not Equal To,
and type May in the box (or point to a cell that contains the word May).
Set the resulting format to white text, so the cell appears empty. If
the cell value is May, the format is the default for that cell.

There's probably other things you might have meant, but those are the
first two solutions I thought of.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

CTInt04 wrote:
Problem: I have a list of all the dates in the year. I want to hide
all of the dates that are not May. I want to hide all the dates
before and after May. How do I hide all the dates except May using a
macro in VB.

Note: Specific cells cant be hidden, because the position of the
dates in May might change. I can make a For...Next loop that does
this, but it hides each row one by one, and takes tooooooo long.


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
Selecting mutliple ranges Scott Graft Excel Worksheet Functions 4 June 13th 08 08:36 PM
V.B selecting ranges for naming ice_cool[_2_] Excel Programming 2 March 5th 04 02:21 PM
Selecting ranges with a text box Bob Metzler Excel Programming 0 September 22nd 03 04:47 PM
Selecting Named Ranges Ian[_8_] Excel Programming 7 September 22nd 03 03:32 PM
selecting ranges MDC Excel Programming 1 July 24th 03 03:34 PM


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