View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jason Jason is offline
external usenet poster
 
Posts: 367
Default Macro to automatically hide rows based on 3 cells

I'm new to vba and have almost no clue how to to work with it, but after
searching several sites, I realize it is most like my best solution. If
anyone can help me that would be great.

The sheet I'm working with is tabbed "Today's Staff" Thought once this works
it will be replicated to reflect each day in the month...that's 37 times. So
this auto hide needs to be workbook associated and not sheet specific.


This sheet pulls alpha code from 4 other tabs (sheets) that are monthly
schedules for different staff groups. This is an IF statement with a HLOOKUP
in it, column AJ. This look up is based on merged cell I3 (a given date)

example: cell AJ7
=IF(HLOOKUP($I$3,'RN-I'!$A$3:$AN$32,AL7,
FALSE)=0,"",HLOOKUP($I$3,'RN-I'!$A$3:$AN$32,AL7, FALSE))

Columns J,K; P,Q; V,W run IF statements that decipher the the letter code
pulled from the monthly schedule into AJ

example: cell J7
=IF($AJ$7="A","–ˆ",IF($AJ$7="B","–ˆ",IF($AJ$7="D ","–ˆ",IF($AI$7="M","–ˆ",IF($AI$7="G","–ˆ","")) )))

Then if there is a "–ˆ" in columns J,K; P,Q; V,W the the matching column I,
O, & U will display the employee name pulled from the month schedule tabs.
again I used IF statements

example: cell I7
=IF('RN-I'!B5="", "",IF(J7="–ˆ",'RN-I'!B5,IF(K7="–ˆ",'RN-I'!B5,"")))

The range of rows that need to be inlcuded is 7 thru 123. It would be nice
if rows 64, 65, 66, 94, 95, & 96 were not included as they are separators
that ID job titles. This is not necessary but would be nice if it could be
accomplished.

Now what I'm after is if the equation for a given row in columns I, O, and U
(all three) results in the display of "", then hide that row of Information.
Otherwise display that row.

Again once I can get this to work, I'm going to replicate it for each day in
a general month. So that all the one needs to do is fill in the 4 month
schedule tabs and then hit print all sheets to have Daily schedule ready for
use.

Thanks for all of the help.
Jason