Macro Help

M

MJD

I've been using the macro below but it doesn't seem to be populating correctly.

I've been trying this out and it keeps freezing up on me.

Here are the rows I need to combine duplicates into one row:
Column A: Last Name
Column B: First Name
Column C: Unique ID

Then the data I need compiled into one record are
Column D - M.

I'm not very advanced with running macros and need a little help with this
one:
Col A: Col B: Col C: Col D:
Company Mon Tues Wed

ABC 12
ABC 34
ABC 56


I would like this to sort, remove duplicate entries and look like this:

Company Mon Tues Wed
ABC 12 34 56

The macro I've been trying to use looks like this:
Sub newlist()
Set w1 = Sheets("Sheet1")
Set w2 = Sheets("Sheet2")
w2.Cells(1, 1).Value = w1.Cells(1, 1).Value
w2.Cells(1, 2).Value = w1.Cells(1, 2).Value
Ide = Cells(1, 1).Value
w1.Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
k = 3
kk = 1
For i = 2 To n
If w1.Cells(i, 1).Value = Ide Then
w2.Cells(kk, k).Value = w1.Cells(i, 2).Value
k = k + 1
Else
kk = kk + 1
k = 3
Ide = w1.Cells(i, 1).Value
w2.Cells(kk, 1).Value = Ide
w2.Cells(kk, 2).Value = w1.Cells(i, 2).Value
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top