ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple (ByVal Target As Range) Cancel each other out, as written (https://www.excelbanter.com/excel-programming/418158-multiple-byval-target-range-cancel-each-other-out-written.html)

BEEJAY

Multiple (ByVal Target As Range) Cancel each other out, as written
 
My initial test of the paramenter worked out great!!

Then I added the other paramaters.
When putting a "1" in cell called TR1_AUG, into parameter 1
parameter 2 obviously cancels it out, so that no ranges are hidden.

I currently have 5 parameters of which only ONE may be selected at any time.
That one selection causes 8 ranges to be hidden. (although more ranges to
hide will likely be required)
It is imperative that the DE-selection of the given cell does UN-hide any
previously hidden ranges.

Can this be done in one go? if so, how?
OR should it be set up as 5 independant subs?
How would that have to be done?

Thank-you

If Range("TR1_AUG") = 1 Then 'Single Cell
Rows.EntireRow.Hidden = False
Range("TR2_PAD_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch2_PAD_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR2_PAD") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR3_FP16") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR2_PAD_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch2_PAD_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If



JLGWhiz

Multiple (ByVal Target As Range) Cancel each other out, as written
 
It would be easier to offer a suggestion if you could explain what you are
trying to accomplish as an end objective.

"BEEJAY" wrote:

My initial test of the paramenter worked out great!!

Then I added the other paramaters.
When putting a "1" in cell called TR1_AUG, into parameter 1
parameter 2 obviously cancels it out, so that no ranges are hidden.

I currently have 5 parameters of which only ONE may be selected at any time.
That one selection causes 8 ranges to be hidden. (although more ranges to
hide will likely be required)
It is imperative that the DE-selection of the given cell does UN-hide any
previously hidden ranges.

Can this be done in one go? if so, how?
OR should it be set up as 5 independant subs?
How would that have to be done?

Thank-you

If Range("TR1_AUG") = 1 Then 'Single Cell
Rows.EntireRow.Hidden = False
Range("TR2_PAD_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch2_PAD_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR2_PAD") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR3_FP16") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR2_PAD_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch2_PAD_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If



BEEJAY

Multiple (ByVal Target As Range) Cancel each other out, as wri
 
You're so right. Not clear at all.

I have two groups of 5 ranges each.
The first group determines which of the 2nd group MAY be required.
ie: Group 1, Range 1, "matches" Group 2, Range 1.

When one of the first 5 ranges is required/selected,
the corresponding Group 2 Range is also to stay available.
The other 4 Ranges, in group 1 and Group 2 to be hidden.
A DE-Select of the selected Range must un-hide all.

PRIMARY SECONDARY
Group 1 Group 2

Range 1-1 Range 2-1
Range 1-2 Range 2-2
Range 1-3 Range 2-3
Range 1-4 Range 2-4
Range 1-5 Range 2-5

Let Select Range 1-1.
Then all except Range 1-1 and Range 2-1 to be hidden.
If Range 1-1 is De-Selected, Than ALL Ranges to be Un-Hidden.

I hope this is somewhat clearer.
Thanks for your efforts to help me out with this.

"JLGWhiz" wrote:

It would be easier to offer a suggestion if you could explain what you are
trying to accomplish as an end objective.

"BEEJAY" wrote:

My initial test of the paramenter worked out great!!

Then I added the other paramaters.
When putting a "1" in cell called TR1_AUG, into parameter 1
parameter 2 obviously cancels it out, so that no ranges are hidden.

I currently have 5 parameters of which only ONE may be selected at any time.
That one selection causes 8 ranges to be hidden. (although more ranges to
hide will likely be required)
It is imperative that the DE-selection of the given cell does UN-hide any
previously hidden ranges.

Can this be done in one go? if so, how?
OR should it be set up as 5 independant subs?
How would that have to be done?

Thank-you

If Range("TR1_AUG") = 1 Then 'Single Cell
Rows.EntireRow.Hidden = False
Range("TR2_PAD_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch2_PAD_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR2_PAD") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR3_FP16_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch3_FD16_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If

If Range("TR3_FP16") = 1 Then
Rows.EntireRow.Hidden = False
Range("TR1_AUG_S, TR2_PAD_S, TR4_FP26_S, TR5_FP36_S, Disch1_AUG_S,
Disch2_PAD_S, Disch4_FD26_S, Disch5_FD36_S").EntireRow.Hidden = True
Else
Rows.EntireRow.Hidden = False
End If




All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com