Offset within the source of a validation list, within a loop.

fortunejake88

New Member
Joined
Sep 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
How do I use offset within the source of a data validation list in VBA? Also, the data validation list is applied with a loop, so "c" is the reference point.

For each c In Range ("AD8:AD316")
With Selection.Validation
.Add Type:=xlValidateList, _ AlertStyle:=xlValidAlertStop, _ Formula1:="Offset(c,0,22,c,0,88)
' other info '
End With
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I think you are using the Excel Offset function syntax.
The VBA equivalent would looks something like this:
VBA Code:
    Dim c As Range
    For Each c In Range("AD8:AD316")
        With c.Validation
            .Add Type:=xlValidateList, _
                AlertStyle:=xlValidAlertStop, _
                Formula1:="=" & c.Offset(0, 22).Resize(, 88).Address
        ' other info '
        End With
    Next c
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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