Hide or unhide a cell base on text in a different cell - Either VBA or formula solution.

Liam_1988

New Member
Joined
Apr 30, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I've been using VBA for about 6 months or so (hobbyist). I'm currently working on a workbook for my job and I'm completely stuck.

XABCD
1​
Sent By:
2​
Date Sent:
3​
Method:Tracking #:

I have the above in place. I'm trying to have it so that C3 & D3 are hidden unless B3 (which has a Data Validation list assigned to it) says "Postal".

I don't mind if this achieved with a Formula or VBA.

Please Please help it's driving me crazy!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,526
Office Version
  1. 365
Platform
  1. Windows
In what way doesn't that 1st bit of code work?
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Liam_1988

New Member
Joined
Apr 30, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
I'm getting this:
1608220925102.png


1608220958933.png

In what way doesn't that 1st bit of code work?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,526
Office Version
  1. 365
Platform
  1. Windows
Did you put that code into the relevant sheet module?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,526
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

It needs to go in the sheet module, not a standard module.
Right click the tab of the sheet you want it to work on & click view code.
Paste the code into the window that opens. The code will run automatically when B83 is changed manually
 

Liam_1988

New Member
Joined
Apr 30, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
It needs to go in the sheet module, not a standard module.
Right click the tab of the sheet you want it to work on & click view code.
Paste the code into the window that opens. The code will run automatically when B83 is changed manually
Right ok sorry yes that makes sense. Sorry like I said I'm a hobbyist.

Just a quick question. Is there a run condition other than the content of D84? I was hoping it was automatic.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,526
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

With the code you showed in post#10
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If Target.Address(0, 0) = "D83" Then
     Rows(87).Hidden = Not Target.Value = "Postal"
  End If
End Sub
Row 87 will automatically hide/unhide when the value in D83 is changed.

Is that not what you want?
 

Liam_1988

New Member
Joined
Apr 30, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
I wanted row 87 to be hidden at all times unless D83 contains the term "Postal" whihc would trigger row 87 to become unhidden.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,526
Office Version
  1. 365
Platform
  1. Windows
In that case just hide row 87, then if D83 is changed to Postal it will unhide & if D83 is then changed to anything other than Postal it will hide again.
 

Liam_1988

New Member
Joined
Apr 30, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
That's not worked Fluff but thanks for your help anyway.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,529
Messages
5,625,354
Members
416,096
Latest member
forevans

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top