|What is valdata? |
It's not a built-in Excel function that I am familiar with, so I'll assume that it's a macro or UDF that was custom written for your spreadsheet.
Since there are countless reasons that VBA would present a rather generic "Run-time-error 1004; Application-defined or object-defined error", there is not enough information in your post for us to be able to offer any suggestions.
We would not only need to see the code and know which line is causing the error, but would need a detailed explanation of how your worksheet is laid-out and what the code is supposed to be doing.
Before you post any code or data, please click on the following line and read the instructions given there.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.