R
Ron Rosenfeld
what I'm doing wrong,
A FUNCTION cannot affect cell attributes.
A FUNCTION can only return a value.
So there is no way that a FUNCTION can change row height.
--ron
what I'm doing wrong,
Ah. So how do we tie into the OutofOrder sheet? If someone adds or removes a "Y" log entry row, it needs to show up on the
OutofOrder sheet.
====================
Private Sub Worksheet_Activate()
[P3].AutoFilter field:=16, Criteria1:="y"
End Sub
===================
Ron Rosenfeld said:I still don't understand how you can ensure you have only one "out of order"
entry marked "y" on your 400 sheets. How do you ensure that someone deletes a
previous out of order entry before entering a new one?
By the way, I do not understand why you go through the bother of hiding the
columns that have the INDIRECT function in them, and testing the presence or
absence of data in a separate column. You could do all that in the same
column. For example, in J4 you have: =INDIRECT("'" & $B4 & "'!B5") and then in
K4 you have =IF(J4>0,J4,""). Why not combine them in J4?
=IF(INDIRECT("'" & $B4 & "'!B5")>0,INDIRECT("'" & $B4 & "'!B5"),"")
Also, if all of your sheet names are without spaces, then you don't need the
apostrophes. So you could use =INDIRECT($B4 & "!F4"), as an example.
Looking at your sample workbook, it seems to me the simplest, and most
automated method would be to use the worksheet activate event on the OutOfOrder
worksheet.
First of all, given the current structure of that worksheet, just change the
code in Q4 to read =P4. You don't need that UDF that you have in there.
Right click on the OutOfOrder tab and select View Code. In the window that
opens, paste the following code:
====================
Private Sub Worksheet_Activate()
[P3].AutoFilter field:=16, Criteria1:="y"
End Sub
===================
Ron Rosenfeld said:====================
Private Sub Worksheet_Activate()
[P3].AutoFilter field:=16, Criteria1:="y"
End Sub
===================
Dennis,
Here is another SUB that seems to work as well. It has the advantage of
perhaps looking a bit "neater" than the autofilter as you do not see the
dropdown lists (down arrows). However, it may take longer to run with 400
lines.
(It is possible to remove the drop down lists on the autofilter command, but
that seems to take a long time, so I do not suggest it).
Enter it as "worksheet code" following the same procedure as I described for
the above.
===========================
Private Sub Worksheet_Activate()
Dim c As Range
Application.ScreenUpdating = False
Cells.Rows.AutoFit
For Each c In [p4403]
If Not c.Text = "y" Then c.RowHeight = 0
Next c
Application.ScreenUpdating = True
End Sub
============================
You may need to change the range p4403 if you move around the "y"
If you combine them, how could you access their value in other formulas? Add this to D4:
=IF(INDIRECT($B4 & "!B4")>0,INDIRECT($B4 & "!B4"),"")
Noticed what happened to I4? Doesn't work anymore. That's why hidden cells like J4 have values I can use in other formulas while
display cells like K4 remove those pecky "1/0/1900" and "0" (unless you have a better way). I wish I could do that on the
individual sheets for cells like B4:B6, D46, F4:F6.
Ah. I'll try it. Thanks for all your help...DennisRon Rosenfeld said:You can remove the 'pecky "1/0/1900" and "0"' by formatting the cells to not
display 0's. That way you don't need the extra columns. So instead of
combining the formulas, in D4, leave the formula as you have it:
=INDIRECT($B4 & "!B4")
and change the format
Format/Cells/Number Custom Type: m/d/yyyy;;
Note the two semicolons at the end. That tells Excel if the value is 0 (or
negative) don't display anything. But the 0 is still available to use for
calculations.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.