Macro to display result of a calculation in excel userform

olutoyin

New Member
Joined
Jun 22, 2011
Messages
15
Dear all,

Please is it possible to get macros that will be used to create forms which displays result based on the entries in a workbook with 3 different sheets.

There is a sheet which displays data from day1 to day 31 of a month.
There is another one which displays payment based on the information in sheet 1.
There is the 3rd sheet which displays usage based on the information on the first worksheet.

I want macros that will allow me select the unique values and date range(e.g day1 - day 5) after which i can select either payment or usage and the result for the calculation is displayed.

Here is the data table:

<table width="704" border="0" cellpadding="0" cellspacing="0"><col style="width:48pt" span="11" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td style="height:15.0pt;width:48pt" width="64" height="20">Unique number</td> <td style="width:48pt" width="64"> Day 1</td> <td style="width:48pt" width="64"> Day 2</td> <td style="width:48pt" width="64">Day 3</td> <td style="width:48pt" width="64">Day 4</td> <td style="width:48pt" width="64">Day 5</td> <td style="width:48pt" width="64">Day 6</td> <td style="width:48pt" width="64">Day 7</td> <td style="width:48pt" width="64">Day 8</td> <td style="width:48pt" width="64">Day 9</td> <td style="width:48pt" width="64">Day 10</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a01</td> <td align="right">0</td> <td align="right">5</td> <td align="right">1</td> <td align="right">-8</td> <td align="right">-12</td> <td align="right">-15</td> <td align="right">-22</td> <td align="right">15</td> <td>
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a02</td> <td align="right">0</td> <td align="right">-5</td> <td align="right">-10</td> <td align="right">-15</td> <td align="right">-25</td> <td align="right">5</td> <td align="right">-1</td> <td align="right">-2</td> <td>
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a03</td> <td align="right">-5</td> <td align="right">-10</td> <td align="right">-15</td> <td align="right">-20</td> <td align="right">-25</td> <td align="right">-30</td> <td align="right">-35</td> <td align="right">-40</td> <td>
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> </tbody></table>
Here is the Usage table

<table width="883" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:4205;width:86pt" width="115"> <col style="width:48pt" span="12" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td style="height:15.0pt;width:86pt" width="115" height="20">Unique number</td> <td style="width:48pt" width="64"> Day 1</td> <td style="width:48pt" width="64"> Day 2</td> <td style="width:48pt" width="64"> Day 3</td> <td style="width:48pt" width="64"> Day 4</td> <td style="width:48pt" width="64"> Day 5</td> <td style="width:48pt" width="64"> Day 6</td> <td style="width:48pt" width="64">Day 7</td> <td style="width:48pt" width="64">Day 8</td> <td style="width:48pt" width="64">Day 9</td> <td style="width:48pt" width="64">Day 10</td> <td style="width:48pt" width="64">Day 11</td> <td style="width:48pt" width="64">Day 12</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a01</td> <td align="right">0</td> <td align="right">4</td> <td align="right">9</td> <td align="right">4</td> <td align="right">3</td> <td align="right">7</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a02</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">10</td> <td align="right">0</td> <td align="right">6</td> <td align="right">1</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a03</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">5</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> </tbody></table>

Here is the payment sheet table

<table width="937" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:3840;width:79pt" width="105"> <col style="width:48pt" span="13" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td style="height:15.0pt;width:79pt" width="105" height="20">Unique number</td> <td style="width:48pt" width="64">Day 1</td> <td style="width:48pt" width="64">Day 2</td> <td style="width:48pt" width="64">Day 3</td> <td style="width:48pt" width="64">Day 4</td> <td style="width:48pt" width="64">Day 5</td> <td style="width:48pt" width="64">Day 6</td> <td style="width:48pt" width="64">Day 7</td> <td style="width:48pt" width="64">Day 8</td> <td style="width:48pt" width="64">Day 9</td> <td style="width:48pt" width="64">Day 10</td> <td style="width:48pt" width="64">Day 11</td> <td style="width:48pt" width="64">Day 12</td> <td style="width:48pt" width="64">Day 13</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a01</td> <td align="right">5</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">37</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a02</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">30</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">a03</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> <td align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20">
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> </tbody></table>The usage sheet was derived from this formula: =IF(AND((Data!C2<Data!B2),(Data!C2<>0)),Data!B2-Data!C2,0)

The payment sheet was derived from this formula: =IF(AND((Data!B2<Data!C2),(Data!C2>0)),Data!C2-Data!B2,0)

Please i need macro that will display the result( usage or payment) for a specific unique number over a period of time( which can be between day1 to day 31).

I will appreciate a prompt response from you.
Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top