Hi there, long time no post!
Office 365, Excel Version 1908.
I have this VBA that loops over all the sheets and I need it to insert different drop-down lists based on column ranges.
It runs without errors, but applies the drop-down to every single cells in each sheet, what am I doing wrong ?
Office 365, Excel Version 1908.
I have this VBA that loops over all the sheets and I need it to insert different drop-down lists based on column ranges.
It runs without errors, but applies the drop-down to every single cells in each sheet, what am I doing wrong ?
VBA Code:
Sub add_drop_downs_2()
Dim LastRow As Long
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
LastRow = ws.Range("L" & Rows.Count).End(xlUp).Row ' Find out the Last Row of Stores Processed Paste
ws.Select
With ws.Range("V2:V" & LastRow).Validation
.Delete 'delete previous validation
.Add Type:=xlValidateList, Formula1:="Y,N"
End With
With ws.Range("W2:W" & LastRow).Validation
.Delete 'delete previous validation
.Add Type:=xlValidateList, Formula1:="Y,N"
End With
With ws.Range("X2:X" & LastRow).Validation
.Delete 'delete previous validation
.Add Type:=xlValidateList, Formula1:="Y,N"
End With
Next ws
Application.DisplayAlerts = False
Application.DisplayAlerts = True
MsgBox ("Finished...")
End Sub