VBA Help : Small Automation using VBA Macros

sachinns

Board Regular
Joined
Jun 21, 2019
Messages
52
Hi Friends,


keyQtyRelated ProductsRelated CostInvoiced at
A-1CAR100$Jan
B-1CAR150$Jan
C0CAR170$Feb
D1Bike50$Feb
E1Bike40$Feb
F1Cycle20$Mar

<tbody>
</tbody>

This is my sheet and i want to automate 3 tasks using VBA . Can someone please help me to do this .

1. Generate a summary page which displays sum of count against each product on column Related Product and Sum of Related Cost .


2. Split complete data to different work sheet on basis of column Invoiced At .


3. Highlight rows which has column QTY value less than 0.
 
Last edited:

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
The three tasks are easy to do manually.

First, select the data, and press Ctrl+T to turn the range into a Table. This will make life easier.

Then, with your active cell in this table, go to the Insert tab of the ribbon, Pivot Table. Choose a cell somewhere. Using the Pivot Table task pane, drag Related Products to the Rows area, then go up and drag it again to the Values area, where Excel automatically changes it to Count of Related Products. Then drag Related Cost to the Values area, where Excel changes it to Sum of Related Costs.

Then select all of the rows of the table, and go to the Home tab of the ribbon, and choose Conditional Formatting. Select New Rule, then Use a Formula. Assuming the active cell is in Row 2, you want this formula:

=$B2<0

and assign some highlight formatting.

SFGvLez.png


If you really want VBA for this, you could record and fix up a macro (or post back).
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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