Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2015, 07:40 AM
zhead zhead is offline Macro to keep first instance and remove duplicates in certain column Windows 7 64bit Macro to keep first instance and remove duplicates in certain column Office 2010 64bit
Advanced Beginner
Macro to keep first instance and remove duplicates in certain column
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Default Macro to keep first instance and remove duplicates in certain column

Hi All,


I have the macro below that I run on several worksheets with no issues. But on all of them it runs on Column "A". I need to modify it to run on a different column on a new worksheet but I am not having any success. Can someone help?

Sub luxation() Dim N As Long N = Cells(Rows.Count, 1).End(xlUp).Row For i = N To 2 Step -1 If Cells(i, 1) = Cells(i - 1, 1) Then Cells(i, 1) = "" End If Next i End Sub
Reply With Quote
  #2  
Old 03-18-2015, 10:10 AM
Snakehips Snakehips is offline Macro to keep first instance and remove duplicates in certain column Windows 8 Macro to keep first instance and remove duplicates in certain column Office 2013
Advanced Beginner
 
Join Date: Mar 2015
Posts: 36
Snakehips is on a distinguished road
Default

zhead,

Perhaps ......

Code:
Sub luxation()
Dim N As Long
Dim c As Integer
'assumes you have the header selected (row 1) for your column of interest
If Selection.Columns.Count > 1 Then Exit Sub

col = Selection.Column  'sets the column number

N = Cells(Rows.Count, col).End(xlUp).Row
For i = N To 2 Step -1
If Cells(i, col) = Cells(i - 1, col) Then
Cells(i, col) = ""
End If
Next i

End Sub
Hope that helps.
Reply With Quote
  #3  
Old 03-18-2015, 10:16 AM
zhead zhead is offline Macro to keep first instance and remove duplicates in certain column Windows 7 64bit Macro to keep first instance and remove duplicates in certain column Office 2010 64bit
Advanced Beginner
Macro to keep first instance and remove duplicates in certain column
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Default

Snakehips,

Thanks very much for your quick reply.
It worked perfect.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to keep first instance and remove duplicates in certain column Need help on duplicates in column; deciding which to keep based on other column nwcf Excel 3 01-31-2014 09:43 AM
Macro to keep first instance and remove duplicates in certain column Macro to remove blank column netchie Word VBA 4 03-14-2013 02:22 PM
Macro to keep first instance and remove duplicates in certain column Macro To Delete Instance across multiple slides. excelledsoftware PowerPoint 2 03-01-2012 07:29 PM
Macro to keep first instance and remove duplicates in certain column Deleting Duplicates in Macro jillapass Excel Programming 1 01-11-2012 10:02 AM
Macro to remove duplicates in Refrences list HowardC Word VBA 0 05-20-2010 09:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft