Error applying validation list to cell based on a named range

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,562
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am running into an error when I'm trying to apply a validation list to a cell based on the values of a named range (nr_crwlist).

Rich (BB code):
Set crwlist = ws_fmatemp.Range("CJ29:CJ" & rw - 1)
crwlist = crwlist
ThisWorkbook.Names.Add Name:="nm_crwlist", RefersTo:=crwlist

For f = 9 To 636
    If ws_fmagui.Cells(f, 23).Interior.Color = RGB(221, 235, 247) Then
        ws_fmagui.Cells(f, 26).Validation.Add Type:=xlValidateList, Formula1:="=nm_crwlist"
    End If
Next f

The line in red breaks with an error: "Application-defined or object-defined error"

Thoughts?
 
Hi all ... thank you for your continued support.

I got it working, a combination of Fluff's suggestion, and the removal of "crwlist = crwlist". I know Jeff you advised it was unnecessary and I had tqaken it out, but when Mike had it in his code at post 6 I put it back in. It seems when it hit that line it removed the values in ws_fmatemp.range("CJ29:CJ39" (the value orw BTW was 40) leaving the range empty. I removed that line, the range didn't clear, and I had the values needed to form the list.

Although I can only mark one solution, I acknowledge credit for the solution to many.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,322
Members
448,564
Latest member
ED38

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