VBA question - refreshing a cell

robjhall

New Member
Joined
Jul 15, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Apologies for my incorrect language on some of my terms but I'm very much a VBA newbie.

I currently have a macro which hides columns depending on the result of a cell. i.e. If cell A1=A then hide columns C:D and if A1=B then hide columns E:F.

It works perfectly fine however the result in cell A1 comes from another sheet which is populated via a validation drop down, now when this is changed (and it subsequently changes cell A1) the sheet doesn't automatically then run the macro to hide the columns.

Any ideas?

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Is your macro a worksheet change event?
 
Upvote 0
In that case you can move it to the sheet with the dropdown & qualify the columns/ranges to be hidden with the sheet name.
 
Upvote 0
So instead of having the macro in the sheet where I want the columns hiding I change this to the sheet with the drop down in and reference to the other sheet which has the columns I want hiding?
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,971
Members
449,059
Latest member
oculus

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