need help with creating macro for unique list from 2 rows

bishop7262

Board Regular
Joined
Jan 9, 2010
Messages
87
I have two columns of names that I need to have a unique list extracted into another row. Is there any way that a macro can be created to pick from 2 columns and placed in another. Here is an example of a macro that I found that lets me create a unique list from one column and gives me the option of putting that list into any column that I choose.

Sub Button18_Click()
Dim rListPaste As Range
Dim iReply As Integer

On Error Resume Next

Set rListPaste = Application.InputBox _
(Prompt:="Please select the destination cell", Type:=8)

If rListPaste Is Nothing Then
iReply = MsgBox("No range nominated," _
& " terminate", vbYesNo + vbQuestion)
If iReply = vbYes Then Exit Sub
End If

'May need to specify [NameofSheet].Range, e.g, Sheet1.Range
Range("A6", Range("A65536").End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=rListPaste.Cells(1, 1), Unique:=True
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,299
Office Version
  1. 365
Platform
  1. Windows
Why not just combine the 2 columns into one and use the code you already have?
 

bishop7262

Board Regular
Joined
Jan 9, 2010
Messages
87
great question. I am trying to make a user friendly excel sheet. I will have many people using this that are not comfortable with using pc much less messing around with excel. So was just wondering if there was a more user friendly way to do this.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,299
Office Version
  1. 365
Platform
  1. Windows
I did mean use code to combine the 2 columns, is that any use?

That should be pretty straightforward unless there's more to what you want to do.

For example, do you want the user to deide where the unique list ends up?
 

bishop7262

Board Regular
Joined
Jan 9, 2010
Messages
87
Sorry misunderstood. I just do not know how to change the code to do what I need. If the code could combine and create a unique list and place it in another column that would be what I am looking for. I would like the unique list to go into a particular column, example c7
 

Watch MrExcel Video

Forum statistics

Threads
1,133,717
Messages
5,660,469
Members
418,580
Latest member
IrishDave2137

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
Top