Fed value to unhide rows in another sheet

  • Thread starter Thread starter Ram
  • Start date Start date
R

Ram

Hi,

In my excel form, I have a field that taked in values from 1 to 5 in
a dropdown,

now for example I select 2 from the dropdown, a series of 10 rows
should get unhidden in another worksheet "Next".

is this possible.

Please help me with a code.

Thanks!
 
How about something like this:

if Sheet1.Range("A1").value = 2 then
Sheet2.Range("1:10").entirerow.hidden = false
end if

Note that Sheet1 and SHeet2 are not the worksheet tab names, but the
worksheet code names. If you want to change the worksheet code names, take
a look at the properties for the worksheet in question and change the
variable titled (Name)

HTH,
Barb Reinhardt
 
How about something like this:

if Sheet1.Range("A1").value = 2 then
Sheet2.Range("1:10").entirerow.hidden = false
end if

Note that Sheet1 and SHeet2 are not the worksheet tab names, but the
worksheet code names. If you want to change the worksheet code names, take
a look at the properties for the worksheet in question and change the
variable titled (Name)

HTH,
Barb Reinhardt










- Show quoted text -

Hi Barb ,
Your code is working fine but only if A1's value is 2.

Is there a way I can declare "cell value A1 in Sheet1" as for i=1to5
And for each value 1 to 5 following should be the output.

If i=1 then Sheet2.range(4:6).hidden = false
else range(4:6).hidden = true

If i=2 then Sheet2.range(4:6)& range(48:50).hidden = false
else range(4:6) & range(48:50).hidden = true

If i=3 then Sheet2.range(4:6)& range(48:50)& range(91:93).hidden =
false
else range(4:6) & range(48:50)& range(91:93).hidden = true

If i=4 then Sheet2.range(4:6) & range(48:50)& range(91:93)&
range(134:136).hidden = false
else range(4:6) & range(48:50)& range(91:93)& range(134:136).hidden =
true

If i=5 then Sheet2.range(4:6) & range(48:50)& range(91:93)&
range(134:136)&range(178:180).hidden = false
else range(4:6) & range(48:50)& range(91:93)&
range(134:136)&range(178:180).hidden = true

Thanks a lot for your help.
 
It sounds like you want a validation list for Sheet1!A1.

Go to the cell that is affected
Data Validation
Allow List
Enter 1,2,3,4,5 in the source area.
 
It sounds like you want a validation list for Sheet1!A1.

Go to the cell that is affected
Data Validation
Allow List
Enter 1,2,3,4,5 in the source area.













- Show quoted text -

Hi Barb,

I have already done Data-> Validation ->list..in the dropdown i have
the following: (Select one,1,2,3,4,5)

Suppose the cell A1 has values 1 to 5 in the dropdown,

I want to declare cell A1 value (for i= 1 to 5)

when i select 1 from the dropdown, In sheet2 i want row range
(4:6).hidden = false
and if I select "Select One", this rage shoud get hidden again i.e.
range(4:6).hidden=true

when i select 2 from the dropdown, In sheet2 i want two row ranges
(4:6) and (48:50) .hidden = false
and if I select "Select One", both the ranges shoud get hidden again
i.e. range(4:6) and (48:50) .hidden=true

when i select 3 from the dropdown, In sheet2 i want three row ranges
(4:6) and (48:50) and(91:93) .hidden = false
and if I select "Select One", all the three ranges shoud get hidden
again i.e. range(4:6) and (48:50) and(91:93).hidden=true

when i select 4 from the dropdown, In sheet2 i want four row ranges
(4:6) and (48:50) and(91:93) and(134:136) .hidden = false
and if I select "Select One", all the four ranges shoud get hidden
again i.e. range(4:6) and (48:50)and(91:93) and(134:136) .hidden=true

when i select 5 from the dropdown, In sheet2 i want five row ranges
(4:6) and (48:50) and(91:93) and(134:136)and(178:180) .hidden = false
and if I select "Select One", all the five ranges shoud get hidden
again i.e. range(4:6) and (48:50)and(91:93) and(134:136)and
(178:180) .hidden=true

Is this possible?
Thanks a lot..
 

Ask a Question

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.

Ask a Question

Back
Top