Storing values after input from a user form


Posted by Alan H on April 23, 2001 4:15 PM

I've built a user form in VBA that is used for inputting a number of values into an Excel spreadsheet. The spreadsheet then calculates the values and displays the results on the user form via VBA. It is, in fact, a pricing program.

However, it is only any good for calculating the price of one product at a time. The user form clears all entries prior to the next calculation. How do I store the data so that I can add together the prices of 2 or more products? I would then like to have the stored values shown on a separate Invoice sheet that can then be printed out.

Posted by Dave Hawley on April 23, 2001 10:32 PM


Hi Alan

All you would need to do is have the values you want to add to the next calculation stored in Variables. Then add,multiply or whatever your Variables to the next lot of data. The Variables will not go back to zero until such time as the Userform is cleared from memory (UnLoaded). To keep records of your data, rather than having the form clear (and lose) the data have it transfered to a worksheet first.

Dave
OzGrid Business Applications



Posted by Craig on April 25, 2001 6:30 AM

Hi Alan. I use this simple macro to store overtime information.

Sheets("GRP DATA").Select
Range("AJ3:EB3").Select
Selection.Copy
Sheets("Archive").Select
Range("A2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False