Custom lists

Daft Ada

New Member
Joined
Jul 20, 2012
Messages
9
Hello, I'm working on a sales form for our field reps which needs a list of radiography machines in one field, and then a list of optional extras for that machine in a second field. Each machine has a different set of extras, so I've created customisable lists for the extras field and it works ok if you just select a machine and then the extras.

What I need the form to do (and I don't know if this is even possible) is to clear the extras field if a different machine is chosen. Basically, I need to avoid any potential for the hospital to choose the wrong extras for their machine.

I've only just started experimenting with macros so I have limited experience using them, but can anyone recommend a solution?

Thanks in advance.

PS. I don't know if this image helps at all?
Excel_List_Help.png
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

scott_n_phnx

Active Member
Joined
Sep 28, 2006
Messages
445
An easy macro that should get you what you need is this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A2:A7")) Is Nothing Then Exit Sub
    If Target.Value = "" Then
        Range("A11:B19").Value = ""
    End If
End Sub

This goes into the worksheet module
-ALT+F11
-Expand VBAProject(Your Workbook.xlsm)
-Double-Click on worksheet module
-ex. Sheet1(Sheet1)
-If the code is a worksheet event (i.e. worksheet_change, worksheet_beforedoubleclick) the code MUST go into the worksheet module for the worksheet that is being watched
-Paste in code

Modify the ranges as needed. This will clear out the items listed under Item, but not delete.

Use in a test workbook first, or a saved copy, so that you do not lose any data.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,576
Messages
5,596,987
Members
414,115
Latest member
SFUser

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