Excel VBA - Return Specific Data from Master Sheet Based on Date Search + Duplicate Certain Items

LookingForHelp1

New Member
Joined
Nov 13, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am a relative beginner to VBA and am a bit over my head on this problem. Not sure anyone will be able to help with this, but I suppose typing my thoughts out might help me to wrap my own brain around exactly what I need to do in any case.

The Problem
I have a large worksheet of data in one master sheet (titled "CPO"). I am looking to create a macro to return specific data from that sheet to another (titled "Search") based on a matching date search. The date is located in cell 'B2' of CPO. I would like to paste these values in the CPO sheet beginning in row 5.

Date values in the master sheet are located in column 'J'. For each entry matching the query date in Column J, I would like to return the data from column 'A' in CPO to column 'A' in Search; from column 'B' in CPO to column 'B' in search; from column 'F' in CPO to column 'C' in Search; from column 'H' in CPO to column 'D' in Search; and from column 'L' in CPO to column 'E' in Search.

A complicating factor is that I need to duplicate this such that each returned row of data appears twice, once with the final pull from column 'L' in CPO appearing in column 'E' in Search, and once with the same number from column 'L' in CPO appearing in column 'F' in search (debits and credits).

Finally, for returned values labeled as "Principal" (located in column 'H' of CPO, to be returned to column 'D' of search), I need to duplicate this once more. The result would be two debits and two credits for each principal payment, and one debt and one credit for each interest payment. Debit would be in column 'E' of Search, and credits would be in column 'F' of Search.


I hope I've described that clearly enough. I realize it is a complicated problem (especially for me), and is something that might be better suited for a different program--unfortunately I need to do this in Excel.

Thanks in advance to anyone who takes the time to read all of that.

I've tried looking around for examples of similar problems online but haven't found something that quite does the trick as of yet.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Two quick corrections from this portion: "The date is located in cell 'B2' of CPO. I would like to paste these values in the CPO sheet beginning in row 5."

This should read: "The date is located in cell 'B2' of Search. I would like to paste these values in the Search sheet beginning in row 5."
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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