VBA - Copying from hidden worksheet and inserting rows/pasting in seperate worksheet

tlc_in_OK

Board Regular
Joined
Jun 27, 2011
Messages
56
I have a hidden worksheet ("RawDataSheet") that pulls from a database, on which column "O" contains the month, i.e. August, September, etc., but not necessarily ALL months. I've written a short macro that finds the distinct months in "O" and copies/pastes them into another worksheet ("CurrentProjects") as headings in column A with a blank row beneath, but now I need to go back and find all the rows that contain/match each month heading, copy columns A thru E of those rows, and paste them underneath each of the headings.

There will always be a variable number of headings/months and rows---for example, currently I have 10 rows that would be copied under the "August" heading, and 13 under "September". But next week, I may have August, September, and October as months that were unique values from "O" on "RawDataSheet", and any number of rows associated with each.

It looks similar to this on "CurrentProjects" sheet I'm pasting to, after my macro copies the month unique values:
Sales Report
DetailNumber
StreetAddress
City
StateProvince
ProjectName
August
September


<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,661
Messages
6,120,796
Members
448,994
Latest member
rohitsomani

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