Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-05-2015, 08:49 AM
zhead zhead is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 64bit
Advanced Beginner
how can I modify this macro to work on another column besides "A"
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Question how can I modify this macro to work on another column besides "A"

Is it possible to modify this macro to work on any column? It seems to only work if my data is in column "A".

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 10-06-2015, 08:27 AM
shg shg is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 32bit
Advanced Beginner
 
Join Date: Oct 2015
Posts: 55
shg is on a distinguished road
Default

One way:

Code:
Sub luxation()
  Dim r             As Range
  Dim iRow          As Long
  Dim iCol          As Long
 
  Set r = ActiveSheet.UsedRange
 
  For iCol = 1 To r.Columns.Count
    For iRow = r.Rows.Count To 2 Step -1
      If r(iRow, iCol).Value2 = r(iRow - 1, iCol).Value2 Then r(iRow, iCol).ClearContents
     Next iRow
  Next iCol
End Sub
Reply With Quote
  #3  
Old 10-06-2015, 02:32 PM
zhead zhead is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 64bit
Advanced Beginner
how can I modify this macro to work on another column besides "A"
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Default

Thanks for your reply. But I only want to remove duplicates in column "R" instead of "A"
So how do I select which column.
Reply With Quote
  #4  
Old 10-06-2015, 03:32 PM
shg shg is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 32bit
Advanced Beginner
 
Join Date: Oct 2015
Posts: 55
shg is on a distinguished road
Default

Code:
Sub luxation()
  Dim i          As Long
 
  With Range("R:R")
    For i = .Cells(.Rows.Count).End(xlUp).Row To 2 Step -1
      If .Cells(i).Value2 = .Cells(i - 1).Value2 Then .Cells(i, 1).ClearContents
    Next i
  End With
End Sub
Reply With Quote
  #5  
Old 10-06-2015, 04:10 PM
zhead zhead is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 64bit
Advanced Beginner
how can I modify this macro to work on another column besides "A"
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Default

Thanks very much. That worked great.
Reply With Quote
  #6  
Old 10-06-2015, 05:04 PM
shg shg is offline how can I modify this macro to work on another column besides "A" Windows 7 64bit how can I modify this macro to work on another column besides "A" Office 2010 32bit
Advanced Beginner
 
Join Date: Oct 2015
Posts: 55
shg is on a distinguished road
Default

You're welcome.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with conditional formatting & returning "Pass" / "Fail Results" in a Column N mikey386 Excel 2 12-11-2014 01:14 PM
remove repeated words with " macro " or " wild cards " in texts with parentheses and commas jocke321 Word VBA 2 12-10-2014 11:27 AM
Modify "preset" animations in PowerPoint 2013 ialpawsv PowerPoint 1 11-26-2014 02:23 PM
Outlook 2003, Modify default "entry type" for new journal entries narichardson Outlook 5 03-14-2012 08:34 AM
how can I modify this macro to work on another column besides "A" How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:37 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