Michael M
Well-known Member
- Joined
- Oct 27, 2005
- Messages
- 21,898
- Office Version
- 365
- 2019
- 2013
- 2007
- Platform
- Windows
Hi All
I am currently adding a data validation list to my spreadsheet.
I want to have the list range in the validation code to be dynamic as the number of lines in my spreadsheet will constantly change.
My problem is when I try to use the Lrow in my list formula it doesn't seem to work.
My way of doing the list is fairly clunky so I'd be more than happy for someone to advise a better way
Regards
Michael M
I am currently adding a data validation list to my spreadsheet.
I want to have the list range in the validation code to be dynamic as the number of lines in my spreadsheet will constantly change.
My problem is when I try to use the Lrow in my list formula it doesn't seem to work.
My way of doing the list is fairly clunky so I'd be more than happy for someone to advise a better way
Code:
lrow = Worksheets("RBE Data").Cells(Rows.Count, "C").End(xlUp).Row
Range("C" & lrow + 6) = "Triangular"
Range("C" & lrow + 7) = "Uniform"
Range("C" & lrow + 8) = "Pert"
Range("C" & lrow + 9) = "LogNorm"
Range("C" & lrow + 10) = "PertAlt"
Range("C" & lrow + 11) = "LogNormAlt"
With Range("N7")
.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=C" & lrow + 6":C" & lrow + 11"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
Regards
Michael M