Vba inquiry with duplicate rowd

Noxas

New Member
Joined
Mar 13, 2025
Messages
5
Office Version
  1. 365
Hey everyone,

I’ve been struggling with this macro for some time now and nothing I’ve tried seems to be working. I have an excel with several rows of data. I require, based on the data in column A, to be duplicated. I then require the data in column d to replace the data in column b in these new rows.

Below is an example. Thank you in advance
 

Attachments

  • IMG_2278.jpeg
    IMG_2278.jpeg
    85.3 KB · Views: 13
Welcome to the Forum!

What output do you expect to see for the example posted?

Does the solution need to be VBA?
 
Upvote 0
Hey everyone,

I’ve been struggling with this macro for some time now and nothing I’ve tried seems to be working. I have an excel with several rows of data. I require, based on the data in column A, to be duplicated. I then require the data in column d to replace the data in column b in these new rows.

Below is an example. Thank you in advance
Ah my example is not that great. So I would expect a duplicate of data 3 and with the data in column c replacing the data in column b in this new data.

I’m writing up a macro and this is the only part I can’t seem to get to work; everything else is in vba
 
Upvote 0
Ah my example is not that great. So I would expect a duplicate of data 3 and with the data in column c replacing the data in column b in this new data.

I’m writing up a macro and this is the only part I can’t seem to get to work; everything else is in vba
Apologies. I meant the data in column D would replace the data in column b in this new data.
 
Upvote 0
What happened to the Data 2 and Data 3 lines?

Can you please show separately:

1. All input cells
2. All required output cells
 
Upvote 0
What happened to the Data 2 and Data 3 lines?

Can you please show separately:

1. All input cells
2. All required output cells
I’m slightly confused. I would need the code to search specifically for Data 1 and duplicate these lines. Data 2 and data 3 would be ignored. First picture is the base set of data. Second photo is the second set of data I would need the vba to duplicate and modify based on the base set of data. Hopefully this makes sense.
 

Attachments

  • IMG_2280.jpeg
    IMG_2280.jpeg
    54.8 KB · Views: 5
  • IMG_2281.jpeg
    IMG_2281.jpeg
    46.9 KB · Views: 4
Upvote 0
I know you want VBA, but just to be clear, does this formula give you the results you want (when you change cell B8)?

ABCD
1Input
2Data 1Info 1123Apple
3Data 1Info 1456Eggs
4Data 2Info 2789Banana
5Data 2Info 2101112Orange
6Data 3Info 3131415Peach
7
8OutputData 2
9Data 2Banana789Banana
10Data 2Orange101112Orange
11
Sheet1
Cell Formulas
RangeFormula
A9:D10A9=CHOOSECOLS(FILTER(A2:D6,A2:A6=B8),{1,4,3,4})
Dynamic array formulas.
 
Upvote 0
Noxas,

Please do not mark a post as the solution if it does not actually contain the solution.
I have removed that designation.
 
Upvote 0

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