Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Find in Column A and Remove from Column B

then use instr

from:
If StrComp(cell, cell.Offset(rowoffset:=0, columnoffset:=1)) = 0 Then
cell.Delete Shift:=xlToLeft

If instr(cell.Offset(rowoffset:=0, columnoffset:=1),cell) 0 Then
cell.Delete Shift:=xlToLeft


"Johnny B" wrote:

Thanks Joel!, this only works if Column A is identical to the entire cell in
column B.
For example

|American Online | American Online |

running the macro will give

|American Online | (empty) |

however, if there is

|American Online | American Online, John Johnson |

nothing happens. Running the macro will give:

|American Online | American Online, John Johnson |

thanks for your help!

~johnny b

"Joel" wrote:

try this code

Sub CompareAB()

Lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Set MyRange = Range(Cells(1, 1), Cells(Lastrow, 1))

For Each cell In MyRange

If StrComp(cell, cell.Offset(rowoffset:=0, columnoffset:=1)) = 0 Then

cell.Delete Shift:=xlToLeft
End If


Next cell

End Sub


"Johnny B" wrote:

Hey Guys, I was wondering if there was a way to create a macro (not
substitute or concatonate) that would Find information from Column A and
Remove it from Column B.
For Example:

from
| Column A | Column B|
| American Online | American Online, Bob |
| Google.com | Google.com 123 Fake Street |

to
| Column A | Column B|
| American Online | , Bob |
| Google.com | 123 Fake Street |

THANKS!!!!

~johnny b

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To find Multiple values in column B for a unique value in column A kishdaba Excel Worksheet Functions 2 November 14th 06 12:49 PM
How to find the most recent date in a column based on other column Veretax Excel Worksheet Functions 7 October 18th 06 05:01 PM
find a specific value in a column and write another column MUSTANG Excel Discussion (Misc queries) 2 February 5th 06 09:24 AM
I need to find the Average from Column A - but Reference Column B BAM718 Excel Worksheet Functions 2 March 15th 05 02:42 PM
Find if value in column A exists in Column B Bzzer Excel Worksheet Functions 1 January 13th 05 02:41 AM


All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"