I'm trying to create a vba code that will update my data validation list range to last row on another sheet. My dropdown list is on my "Home" tab which takes its list range from column P on "Mapping tab". The list will change daily so wanted to add in the formaula to look for finalrow rather than entering a cell row value. Here is the code I have written but a error occurs with the formula.
Sub getDropdownList()
Dim finalrow1 As Integer
'finds last row in Column P on Mapping tab
Sheets("Mapping").Select
finalrow1 = ActiveSheet.Cells(Rows.Count, "P").End(xlUp).Row
Sheets("Home").Select
Range("E7").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Mapping!$P$1:$P &finalrow1"
End With
End Sub