5element
07-15-2017, 07:48 AM
Hello,
The below macro removes duplicates in column A and is working fine, butI want the macro to also remove information from column B because, the data from column A is assigned to column B
Not sure how to do this?
Could you help me.
Set Des = ActiveWorkbook.Worksheets("Des")
Set Copy1 = ActiveWorkbook.Worksheets("Copy1")
Sheet1.Range("A1:A200").Copy Destination:=Des.Range("A1")
Sheet1.Range("B1:B200").Copy Destination:=Des.Range("B1")
Copy1.Range("E1:E200").Copy Destination:=Des.Range("C1")
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
' Get count of records to search through (list that will be deleted).
iListCount = Sheets("Des").Range("A1:A10").Rows.Count
' Loop through the "master" list.
For Each x In Sheets("Des").Range("C1:C200")
' Loop through all records in the second list.
For iCtr = 1 To iListCount
' Do comparison of next record.
' To specify a different column, change 1 to the column number.
If x.Value = Sheets("Des").Cells(iCtr, 3).Value Then
' If match is true then delete row.
Sheets("Des").Cells(iCtr, 1).Delete xlShiftUp
' Increment counter to account for deleted row.
iCtr = iCtr + 1
End If
Next iCtr
Next
Application.ScreenUpdating = True
The below macro removes duplicates in column A and is working fine, butI want the macro to also remove information from column B because, the data from column A is assigned to column B
Not sure how to do this?
Could you help me.
Set Des = ActiveWorkbook.Worksheets("Des")
Set Copy1 = ActiveWorkbook.Worksheets("Copy1")
Sheet1.Range("A1:A200").Copy Destination:=Des.Range("A1")
Sheet1.Range("B1:B200").Copy Destination:=Des.Range("B1")
Copy1.Range("E1:E200").Copy Destination:=Des.Range("C1")
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
' Get count of records to search through (list that will be deleted).
iListCount = Sheets("Des").Range("A1:A10").Rows.Count
' Loop through the "master" list.
For Each x In Sheets("Des").Range("C1:C200")
' Loop through all records in the second list.
For iCtr = 1 To iListCount
' Do comparison of next record.
' To specify a different column, change 1 to the column number.
If x.Value = Sheets("Des").Cells(iCtr, 3).Value Then
' If match is true then delete row.
Sheets("Des").Cells(iCtr, 1).Delete xlShiftUp
' Increment counter to account for deleted row.
iCtr = iCtr + 1
End If
Next iCtr
Next
Application.ScreenUpdating = True