Excel/User Form in Excel
I am working on a spreadsheet in excel that lists 4 compounds, there molecular weights, k-values, Peak Areas, Mole and Mass Fractions. There are 5 samples of these for compounds. The k-values are constant throughout. The Peak Areas are different for each compound and each sample. I have written a VBA code to calculate the Mole and Mass Fraction. Everything is correct in the array boxes.
Sample MW k-Values Peak Areas Mole Frac. Mass Frac.
1 16.04 0.150 3.6 0.156 0.062
30.07 0.287 2.8 0.233 0.173
44.09 0.467 2.4 0.324 0.353
58.12 0.583 1.7 0.287 0.412
2 -- -- -- -- --
and so on through sample 5.
I have been asked to construct a user form to return the mole and mass fractions as well. The user will enter the k-values, number of compounds, number of samples, and peak areas. The Moles and Mass Fractions are to be displayed on the worksheet and not the user form. I am not real sure how to write the code for this.
The information for this project is suppose to be values that are collected from a gas chromatograph.
For this example the moles for each compound = k * Peak Area.
The Mole Fraction = moles(i) / total moles in each sample.
The Mass Fraction = Mass(i) / total Mass in each sample.
Can you please help?
Also I am a beginner to VBA and UDF codes.
Thank you for your time!
Firstly I want to apologize for my slow response. I saw your question last week but didn't have time then to do it, and I forgot that I had a question pending until I got notification from AllExperts that it was overdue.
It would take quite a bit of explanation to give all the steps in setting up such a userform and I think that showing you such a userform and its associated code would be much easier. Here is my email address: VBAexpert@myway.com. If you email me I will send you back an example userform that does basically what you describe. Even better, if you could send me your Excel worksheet with the sample 1-5 data sets I could add the userform and code to your workbook and email it back to you.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here