Help...code needed to ignore null cells
Hi puakeni,
This should do it for you...
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer
Dim myList As String
On Error Resume Next
If Cells(2, 18) = False Then Exit Sub
With Target
If .Column = 2 And _
.Row 2 And _
.Row < ActiveSheet.UsedRange.Row + _
ActiveSheet.UsedRange.Rows.Count Then
.EntireColumn.Validation.Delete
For i = 10 To 16
If Not Cells(Target.Row, i) = "" Then
myList = myList & Cells(Target.Row, i) & Chr(10)
End If
Next i
With .Validation
.Add Type:=xlValidateInputOnly
.InputTitle = "" ' Optional
.InputMessage = myList
End With
End If
End With
End Sub
Kind regards,
Nick.
|