I have the following code that I'm using to validate survey responses. The defined range should have no zeros, and if it does, the msgbox will appear to let the respondent know that they skipped an item or items, as well as the item number(s).
I'm getting the error at the lineDim vCell As Range Sheets("Calculations").Range("C4:C53").Name = "val_range" For Each vCell In Range("val_range") If ActiveCell.Value = 0 Then msg = msg & ActiveCell.Offset(0, -2).Value & vbCr k = k + 1 End If Next vCell
I borrowed this code from an expert in another post while researching a different question, and only changed the particulars, so I'm not sure why it's failing. I suspect it may have to do with the fact that the sheet is initially hidden, though I'm unhiding it earlier in this procedure. I also attempted to activate the sheet first, but still get the error.For Each vCell In Range("val_range")
What am I missing?