Hide Columns based on value in each column in a specific Row

gootly

New Member
Joined
Jan 31, 2022
Messages
10
Office Version
  1. 2021
Platform
  1. Windows
I have a Excel 2021 on Windows spreadsheet with many columns and rows

I need a macro that can look at every column from B to SL and hide that column if the value of row 1790 is below 200%. For complete disclosure row 1790 is a calculation of two other elements in the column divided by the other and the result is displayed as a percentage
Example =B1783/B1279

or simply show columns where row value of cell 1790 in that column is above 200%

I am open to suggestions. I have researched for days but not found a solution that applies.

Thanks in advance.

Mark
 
Well, 'scuse me for being stupid.
Good luck.


Micron,

You are NOT stupid. I just wanted to clarify. I many times misread things and misunderstand out of the gate.

I still want to thank you for interacting on the question.

Mark
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
How about
VBA Code:
Sub gootly()
   Dim Cl As Range
   Application.ScreenUpdating = False
   For Each Cl In Range("B1790:SL1790")
      If IsError(Cl.Value) Then
         Cl.EntireColumn.Hidden = True
      Else
         Cl.EntireColumn.Hidden = Cl.Value < 2
      End If
   Next Cl
End Sub
 
Upvote 0
Solution
Fluff,

That nailed it. Thanks. As a non programmer, I do not know how you come up with these things so quickly. They seem far from intuitive to me from looking at the code.

Mark
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Glad we could help & thanks for the feedback.
Fluff,

One last thing. Is there a way to reverse what is done so I can see all the data? Do I need a macro or do I just have to click on something to view all hidden columns.

I tried selecting everything and choosing unhide but it did nothing.

Mark
 
Upvote 0
Fluff,

One last thing. Is there a way to reverse what is done so I can see all the data? Do I need a macro or do I just have to click on something to view all hidden columns.

I tried selecting everything and choosing unhide but it did nothing.

Mark


OOps, when I hit unhide, I see that the hidden columns are actually there but so small that they are hidden. I will find a way to restore them to a viewable size.
 
Upvote 0
If you select all & right click on the column headers you can choose column width
 
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,217
Members
448,951
Latest member
jennlynn

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
Back
Top