6 Replies - 794 Views - Last Post: 14 May 2013 - 04:45 AMRate Topic:

My 1st Vba project - something in the logic escapes me

Posted 13 May 2013 - 04:23 PM

They assigned me this at work to alleviate problems with our production people overwriting formulas or editing data.
I've never had to write an automation code for a spreadsheet before, so I hope I had the right idea here. the spreadsheet this stuff goes into has about only ten columns to fill.
Essentially, what happens is that a product(electronic devices on wafers) is accurately weighed before processing. The code interacts with the operator through a series of dialog boxes and userforms to input values into the correct cells on a worksheet. After processing(electroplating), the article is weighed again and difference with the pre-processing weight is presumed to be the quantity of metal deposited. Therefore, the spreadsheet has two command buttons - pre-process and post-process data entry. What I have down so far has a few bugs in it - but it messes up when there is only one wafer in the lot, so there's a logic error in here that I'm not seeing. I've gotten run-time errors, too & more might occur since I haven't completely tested the code for robustness in all foreseeable inputs and situations.
There are 4 userforms that are encountered: The first is called simply UserForm1, the second box encountered I've named AddRemoveWafers for adjusting a wafer lot after upstream scrap losses. The third box is called WaferData - it includes user inputs that are unique to an individual wafer. Finally, the PostWeigh_Wfrs form is used after the process is complete to upload the post electroplated weight of the entire wafer and calculate the pre and post weight difference to check & see if it's within specs. I don't currently have this block of code on hand, but it's relatively simple & I haven't had issues with it. But it does raise one question..Can the backcolor and/or font color in a textbox be changed using a Vba conditional statement?

Re: My 1st Vba project - something in the logic escapes me

Posted 14 May 2013 - 04:45 AM

All right - thanks all for taking a look, but I think I've got it fixed & running now. I'll remember this board if anything else comes up & read some of the topics posted here to hopefully improve my competence.