Help on Avoiding Duplicates

Willmonbo

Board Regular
Joined
May 16, 2010
Messages
141
I have a list of employees that I keep adding to when someone new is hired, to avoid duplicates I formatted the column with a true/false conditional formatting to reject duplicate records, however, my problem is that I want now that a macro should copy the new hires from a different cell and place it in the employee list and the macro pastes into the employee list even in the event of a duplicate.

I'd greatly appreciate some suggestions
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I have a list of employees that I keep adding to when someone new is hired, to avoid duplicates I formatted the column with a true/false conditional formatting to reject duplicate records, however, my problem is that I want now that a macro should copy the new hires from a different cell and place it in the employee list and the macro pastes into the employee list even in the event of a duplicate.

I'd greatly appreciate some suggestions

Hello there,

Very simple line of code but it works if i got it right as what you've asked
Just enter in the prompt boxes your range and it will copy the new list under your original one. In my example i assume that your startiing list begins at line A1

Sub addemployee()
Application.ScreenUpdating = False


Dim i As String
Dim j As String

i = InputBox("Enter the starting cell")
j = InputBox("Enter the ending cell")

Range(i, j).Select
Selection.Copy

Range("a1").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveSheet.Paste

Application.ScreenUpdating = True
Application.CutCopyMode = False

'MsgBox "test"
End Sub



Hope this helps
 
Upvote 0
Hello there,

Very simple line of code but it works if i got it right as what you've asked
Just enter in the prompt boxes your range and it will copy the new list under your original one. In my example i assume that your startiing list begins at line A1

Sub addemployee()
Application.ScreenUpdating = False


Dim i As String
Dim j As String

i = InputBox("Enter the starting cell")
j = InputBox("Enter the ending cell")

Range(i, j).Select
Selection.Copy

Range("a1").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveSheet.Paste

Application.ScreenUpdating = True
Application.CutCopyMode = False

'MsgBox "test"
End Sub



Hope this helps

Forgot to add two lines of code. Now these should work better in case you changed your mind and don't want to perform any action with these prompt boxes


Sub addemployee()
Application.ScreenUpdating = False


Dim i As String
Dim j As String

On Error GoTo stopadding

i = InputBox("Enter the starting cell")
j = InputBox("Enter the ending cell")

Range(i, j).Select
Selection.Copy

Range("a1").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveSheet.Paste

Application.ScreenUpdating = True
Application.CutCopyMode = False

stopadding: End

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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