Macro To Replace Existing Data With Newly Copied Data

MarkStrong

New Member
Joined
Aug 11, 2015
Messages
2
Hi guys,

I wasn't able to find this question in any of my searches so it would be great if you could help me out.

I want to create a macro that will copy a set of data (identified by common field, ie. Coffee Type in this example) and replace existing data in a separate worksheet.

I.e.:
Worksheet 1:
ABC
Coffee TypeTemperatureSize
LatteMediumLarge

<tbody>
</tbody>

Copy data (A2:C2) and then paste in the following worksheet, if Latte is pre-existing then overwrite Latte data else paste a new row at the end.

Worksheet 2:

If Latte data is already there, find and replace over it (i.e. it would update Small to Large)


ABC
Coffee TypeTemperatureSize
LatteMediumSmall

<tbody>
</tbody>


Or if Latte is not there, paste at the end (in red):


ABC
Coffee TypeTemperatureSize
Espresso shotHotSmall
LatteMediumLarge

<tbody>
</tbody>



This has been doing my head in for a couple days so thank you for any help you could offer.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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