VBA For Removing Duplicates

srj1359

New Member
Joined
Mar 5, 2015
Messages
37
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!
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
51,001
Office Version
  1. 365
Platform
  1. Windows
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
 

srj1359

New Member
Joined
Mar 5, 2015
Messages
37
Office Version
  1. 2016
Platform
  1. Windows
@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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
51,001
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,983
Messages
5,575,371
Members
412,657
Latest member
georgean
Top