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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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