VBA For Removing Duplicates

srj1359

New Member
Joined
Mar 5, 2015
Messages
46
Office Version
  1. 2016
Platform
  1. Windows
Hello!

I have a workbook in which data from multiple customers is added to a new sheet by pushing a button.

Example: Select customer A from sheet 1, push button, data is transferred to sheet 2. Then select customer B from sheet 1, push button, data is transferred to sheet 2 under customer A data.

I want to make sure no lines repeat on sheet 2, so I'm creating a button to remove duplicates. Column A is the customer number and column E is the product code, so if I concatenate these, it will give me a unique ID for each line. I'm wanting to do this concatenation in column S starting in cell S9 and then autofill to the last row with data in it (column A would be a good reference point for a full column).

I have columns A-U and row 8 is where the column headers are

Everything I've tried isn't giving me any error messages, but is also not giving me anything in column S, so I'm doing something wrong. Help?

Thanks in advance!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
How about
VBA Code:
Sub saloelrn()
   With Sheets("Sheet2")
      With .Range("S9:S" & .Range("A" & Rows.Count).End(xlUp).Row)
         .Formula = "=A9&E9"
      End With
   End With
End Sub
 
Upvote 0
Solution
@Fluff you make it seem so easy. That worked great and I was able to build on that with coding to remove duplicates. Thank you so much!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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