Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation List

Status
Not open for further replies.

LGMan

MIS
Aug 27, 2003
233
GB
Hi,
I'm using a validation list to present a dropdown list to the end user which is straight forward. However the data that is pulled into the dropdown will vary in the number of rows each day.
I'd like to be able to automate the last row value into the validation.
I can display the last row via...

Dim Lastrow As Long
Sheets("Ind Summary").Select
Lastrow = Range("K65536").End(xlUp).Row
LastrowK = "K" & Lastrow

Application.ScreenUpdating = False
With Range("I2")
.Value = LastrowK

However I can't get see how to incorporate LastrowK into the following

With Range("D6").Validation
.Delete
.Add xlValidateList, xlValidAlertStop, xlBetween, "=$K$2:$K$542"
.InCellDropdown = True
End With

Any help or advice greatly received
 


Hi,

Use a Named Range for you list.

Reference the Named Range in your Validation.

faq68-1331.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
.Add xlValidateList, xlValidAlertStop, xlBetween, "=$K$2:$K$" & Lastrow

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks Skip, something to think about for implementing within future routines that I've got planned

Also thanks to PHV, just what I needed to get the code working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top