Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2015, 10:32 PM
NoSparks NoSparks is offline Hide a combo box (form control), based on a cell value - Excel 2010 Windows 7 64bit Hide a combo box (form control), based on a cell value - Excel 2010 Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

The change of value in the linked cell does not fire the Worksheet_Change event.
You could use the Worksheet_SelectionChange event but the 3 drop downs would not hide and unhide when the drop down 3 changes A11 until the cursor gets moved into another cell. This could leave things in the wrong state for considerable time.
I'd use the Worksheet_Calculate event. This requires making another cell somewhere on the sheet =A11 to make sure something gets calculated the instant the value in A11 changes. The Calculate event fires every time something, anything, on the sheet gets calculated so there is the potential that having this event do things could affect Excels performance in which case you could have the =A11 cell on a separate sheet with nothing else and move the code over to that sheet.



Right click on the sheet tab your drop downs are on, select view code then paste this into the sheet module that appears.
Code:
Private Sub Worksheet_Calculate()
    Dim ws As Worksheet

Set ws = Sheets("Price Calculator")

If Range("A11") < 2 Then
    ws.Shapes("Drop Down 11").Visible = False
    ws.Shapes("Drop Down 12").Visible = False
    ws.Shapes("Drop Down 13").Visible = False
Else
    ws.Shapes("Drop Down 11").Visible = True
    ws.Shapes("Drop Down 12").Visible = True
    ws.Shapes("Drop Down 13").Visible = True
End If

End Sub
Reply With Quote
  #2  
Old 07-12-2015, 05:15 AM
jaymudda jaymudda is offline Hide a combo box (form control), based on a cell value - Excel 2010 Windows 7 64bit Hide a combo box (form control), based on a cell value - Excel 2010 Office 2010 64bit
Novice
Hide a combo box (form control), based on a cell value - Excel 2010
 
Join Date: Jul 2015
Location: london
Posts: 6
jaymudda is on a distinguished road
Default Hide a combo box (form control), based on a cell value - Excel 2010

Thank you NoSparks!! Very helpful

Correct me if I'm wrong, my understanding of what you've said is:


1) Start a new worksheet in the same workbook, say its called "Backend"

2) Put a formula in a cell, say C1, and that formula should be
= 'Price Calculator'!$A$11

3) Change your code where it says:
If Range("A11") < 2 Then
To If Range("C1") < 2 Then

4) Paste this code onto the "Beckend" worksheet, and NOT the "Price Calculator" worksheet

If I have understood you correctly, what would the code call the combo boxes??

Would they not have to be referenced to the "Price Calculator" worksheet??



PS I have tried your code exactly as it is straight into the worksheet coding, and it works a treat but would still like the above guidance if poss!!!!
Reply With Quote
Reply

Tags
combo box, combobox, vba macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Hide/Un-hide a worksheet based on cell on another sheet. easton11 Excel Programming 1 06-02-2015 12:07 PM
Word 2010 Content Control help - Combo Boxes vs Drop Down List proghy Word 1 09-16-2014 02:01 PM
Hide a combo box (form control), based on a cell value - Excel 2010 Allow Multiple Content Control same cell of form table DeborahBartlett Word 1 01-04-2014 11:06 AM
Hide a combo box (form control), based on a cell value - Excel 2010 Hide Rows and Update Chart based on cell value ubns Excel Programming 5 05-07-2012 05:44 AM
Hide a combo box (form control), based on a cell value - Excel 2010 Hide a combo box DrewB Word 3 06-08-2009 11:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft