On Error - Assign a value to variable causing error

way2bord

Registered User.
Local time
Yesterday, 18:50
Joined
Feb 8, 2013
Messages
177
Is the following possible? If so - how?

I have a series of several hundred variables being assigned values.

If the value assigned to the variable results in an error, I would like to assign a default value to the variable which caused the error.

How do I reference the variable, or line (or any info I can work with), which caused the error?
 
Set the default value first, when the variable is initialized, then if a later assignment fails *poof* the default is set.

But "several hundred variables?" How are you doing this? In VBA code? Array elements?

Can you convert "several hundred things" to "one thing in a loop that runs several hundred times?"
 
Set the default value first, when the variable is initialized, then if a later assignment fails *poof* the default is set.

But "several hundred variables?" How are you doing this? In VBA code? Array elements?

Can you convert "several hundred things" to "one thing in a loop that runs several hundred times?"

:banghead: doh. Simply reversing the order will do it.


I was provided the most ridiculous non-normalized "pretty" excel template.

I thought the quickest solution would be to just hardcode all the cell positions holding data, then iterate through the forms. Turns out some of the cells have crap data (i.e. strings instead of numbers); I intend to default all crap.
 

Users who are viewing this thread

Back
Top Bottom