Vba Pop-up that displays cell values or sums categories

snackpack

New Member
Joined
Mar 14, 2013
Messages
3
Hi,
I'm trying to program a relatively simple pop-up box in Excel, but I am not too familiar with <ACRONYM title="visual basic for applications">vba</ACRONYM> code. The situation is that I have a worksheet in an excel workbook linked to a .csv file that updates daily with inventory information. I want the pop-up to display the total weight of inventory in various categories. Each row on the linked sheet is a unique piece of inventory & has a column w/ category and weight. However, the number of rows will vary daily based on how much inventory is in stock. So, a small portion of the worksheet would look something like the table below. Then, on a separate "start" worksheet in the book there would be a button that says "Sum Inventory" and when pressed a pop-up would appear that displays:
"Category A - 30 tons
Category B - 15 tons
Category C - 60 tons"

But the summation would change daily based on how much inventory is in each category.

I suppose I could link the pop-up text to particular cells on the data sheet (outside of the data range) that contain sumif formulas, or that could somehow be written into the code?

Thanks for your help!
Dave
PieceWeightCategory
110A
215B
320A
420C
540C

<TBODY>
</TBODY>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I'd use a summary sheet linked to the total, using sumif to provide the information. It would be much quicker than try to learn VBA.
 
Upvote 0
you can insert a column for the total sum of A,B & C.

E.G column D is total sum
D1 = A, D2 = B, D3 = C

D1 = =SUMIF(C:C,"A",B:B)
D2 = =SUMIF(C:C,"B",B:B)
D3 = =SUMIF(C:C,"C",B:B)

Press alt + f11, select thisworkbook and change general to workbook.

Code:
Private Sub Workbook_Open()
MsgBox ("Category A -" & Range("D1") & " tons")
MsgBox ("Category B -" & Range("D2") & " tons")
MsgBox ("Category C -" & Range("D3") & " tons")
End Sub

and save as excel enable macro, close and open the workbook again, you will get the result.
 
Upvote 0

Forum statistics

Threads
1,221,444
Messages
6,159,914
Members
451,603
Latest member
SWahl

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