Consolidate rows with a macro based on lack of value in certain columns

rockthecasbah121

New Member
Joined
Aug 9, 2019
Messages
7
I'm working on fixing a spreadsheet for work with very little VBA knowledge. I've got the original sheet working again but now would like to add a consolidation button for times when the outputted table is too long.

This is an example of the output table from the macro:
view


I'd like to output to a new sheet all of this same data, but for rows where an entry has no value in columns A-E or G-H, I'd like to consolidate in to one row and total up the amounts in columns F,I,J.

view


I've seen something similar on this message board, but it needs tweaked just a little bit for my situation I believe, and I couldn't figure out the tweaking... Any help is much appreciated.
 
You're welcome.
The new last row number after running the code is the value of the variable "c".
So, the next row after that is "c+1", so for column "A" this is:- cells(c+1,1) or for the entire data row is:- cells(c+1,1).resize(,12)
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Something about that isn’t working for me. Would c+1 be dependent on where the consolidated row gets placed? Sometimes the formatting ends up on the totals row but sometimes it ends up two rows below the consolidated row but above the totals row still.
 
Upvote 0
Not really, the value of "c" at the end of the code would equate to the last row of data in the array "Ray", but remember the data is placed, starting in row 4 , so you would have to add 4 to get the actual last "row +1"

Maybe:-
Try this at the bottom of the code to get the last row of data in column "A" + one row
The
Code:
Dim Lst as long
Lst = Range("A" & Rows.Count).end(xlup).row+1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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