halesowenmum
Active Member
- Joined
- Oct 20, 2010
- Messages
- 383
- Office Version
- 365
- Platform
- Windows
Hi
I have a workbook within which there is a worksheet called Actions. In cells H5:H18 I want to reference worksheet Lists, cells C22:C29.
I have the VBA for the thing I'm trying to do (allow multiple selections from the drop down list) so that's all fine, but my VBA knowledge is very limited such that I don't know how or where exactly to edit the VBA provided to me, shown below to ensure I'm referencing the locations I need:
Can someone kindly advise me with what to adjust where?
Thank you.
I have a workbook within which there is a worksheet called Actions. In cells H5:H18 I want to reference worksheet Lists, cells C22:C29.
I have the VBA for the thing I'm trying to do (allow multiple selections from the drop down list) so that's all fine, but my VBA knowledge is very limited such that I don't know how or where exactly to edit the VBA provided to me, shown below to ensure I'm referencing the locations I need:
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 3 Then
If oldVal = "" Then
'do nothing
Else
Thank you.
Last edited by a moderator: