#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default text match?

Hello all,
I'm using the following to copy weekly sales quote info
to a running master list:

Sub quotestomaster()

Set Rng1 = Workbooks("JeffQuotes_weekly.xls"). _
Sheets("Sheet1").Range("B3:R22")
Set Rng2 = Workbooks("JeffActiveQuotes.xls"). _
Sheets("Sheet1").Range("A" & Rows.Count).End
(xlUp).Offset(1, 0)
Rng1.Copy Rng2
End Sub

Since each job name is unique (appears in column B of
weekly file, column A in master) I want to ensure that no
duplications occur on the master. So, I need to see if a
match exists and if so, either don't copy it in the first
place or delete the match after copying. Wondering if I
can do something (in theory) in the master like...

=IF(TEXT(A1,"abcdefghijklmnopqrstuvwxyz")
="abcdefghijklmnopqrstuvwxyz" Then
EntireRow.Delete

Thanks in advance for response!
Erin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default text match?

Erin ,

Try this formula

=IF(COUNTIF($A$1:$A$100,A1)1, "Duplicate","")

put it in B1 on the Master and copy down, and it will highlight the
duplicates.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"erin" <espencer@wdprosdotcom wrote in message
...
Hello all,
I'm using the following to copy weekly sales quote info
to a running master list:

Sub quotestomaster()

Set Rng1 = Workbooks("JeffQuotes_weekly.xls"). _
Sheets("Sheet1").Range("B3:R22")
Set Rng2 = Workbooks("JeffActiveQuotes.xls"). _
Sheets("Sheet1").Range("A" & Rows.Count).End
(xlUp).Offset(1, 0)
Rng1.Copy Rng2
End Sub

Since each job name is unique (appears in column B of
weekly file, column A in master) I want to ensure that no
duplications occur on the master. So, I need to see if a
match exists and if so, either don't copy it in the first
place or delete the match after copying. Wondering if I
can do something (in theory) in the master like...

=IF(TEXT(A1,"abcdefghijklmnopqrstuvwxyz")
="abcdefghijklmnopqrstuvwxyz" Then
EntireRow.Delete

Thanks in advance for response!
Erin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default more info - text match?

Erin,

Try this then

Sub DeleteDuplicates()
Dim cLastRow As Long

With ActiveSheet
cLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("B1").FormulaR1C1 = "=IF(COUNTIF(R2C1:RC1,RC[-1])1,
""Duplicate"","""")"
.Range("B1").AutoFill Destination:=.Range("B1", .Cells(cLastRow,
"B")), Type:=xlFillDefault
.Range("A1").EntireRow.Insert
.Range("B1").FormulaR1C1 = "Test"
.Columns("B:B").AutoFilter Field:=1, Criteria1:="Duplicate"
.Cells.SpecialCells(xlCellTypeVisible).EntireRow.D elete
End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"erin" <espencer@wdprosdotcom wrote in message
...
Hi,
Thanks for the response Bob.

I wanted to clarify... if I go with the idea of deleting
duplicates from the master, then after these are
identified, I need to *automatically* delete them.

-----Original Message-----
Hello all,
I'm using the following to copy weekly sales quote info
to a running master list:

Sub quotestomaster()

Set Rng1 = Workbooks("JeffQuotes_weekly.xls"). _
Sheets("Sheet1").Range("B3:R22")
Set Rng2 = Workbooks("JeffActiveQuotes.xls"). _
Sheets("Sheet1").Range("A" & Rows.Count).End
(xlUp).Offset(1, 0)
Rng1.Copy Rng2
End Sub

Since each job name is unique (appears in column B of
weekly file, column A in master) I want to ensure that

no
duplications occur on the master. So, I need to see if

a
match exists and if so, either don't copy it in the

first
place or delete the match after copying. Wondering if I
can do something (in theory) in the master like...

=IF(TEXT(A1,"abcdefghijklmnopqrstuvwxyz")
="abcdefghijklmnopqrstuvwxyz" Then
EntireRow.Delete

Thanks in advance for response!
Erin
.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default more info - text match?

Beautiful! Thanks much :-)

-----Original Message-----
Erin,

Try this then

Sub DeleteDuplicates()
Dim cLastRow As Long

With ActiveSheet
cLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("B1").FormulaR1C1 = "=IF(COUNTIF

(R2C1:RC1,RC[-1])1,
""Duplicate"","""")"
.Range("B1").AutoFill Destination:=.Range

("B1", .Cells(cLastRow,
"B")), Type:=xlFillDefault
.Range("A1").EntireRow.Insert
.Range("B1").FormulaR1C1 = "Test"
.Columns("B:B").AutoFilter Field:=1,

Criteria1:="Duplicate"
.Cells.SpecialCells

(xlCellTypeVisible).EntireRow.Delete
End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"erin" <espencer@wdprosdotcom wrote in message
...
Hi,
Thanks for the response Bob.

I wanted to clarify... if I go with the idea of

deleting
duplicates from the master, then after these are
identified, I need to *automatically* delete them.

-----Original Message-----
Hello all,
I'm using the following to copy weekly sales quote

info
to a running master list:

Sub quotestomaster()

Set Rng1 = Workbooks("JeffQuotes_weekly.xls"). _
Sheets("Sheet1").Range("B3:R22")
Set Rng2 = Workbooks("JeffActiveQuotes.xls"). _
Sheets("Sheet1").Range("A" & Rows.Count).End
(xlUp).Offset(1, 0)
Rng1.Copy Rng2
End Sub

Since each job name is unique (appears in column B of
weekly file, column A in master) I want to ensure that

no
duplications occur on the master. So, I need to see

if
a
match exists and if so, either don't copy it in the

first
place or delete the match after copying. Wondering

if I
can do something (in theory) in the master like...

=IF(TEXT(A1,"abcdefghijklmnopqrstuvwxyz")
="abcdefghijklmnopqrstuvwxyz" Then
EntireRow.Delete

Thanks in advance for response!
Erin
.



.

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
Match text L Excel Worksheet Functions 1 June 24th 08 08:06 PM
Match a text Christopher Naveen[_2_] Excel Worksheet Functions 4 September 27th 07 12:31 PM
Lookup? Match? pulling rows from one spreadsheet to match a text f cjax Excel Worksheet Functions 3 July 21st 06 02:51 PM
How to match two different cells text, if the text is not in the . LEsa Excel Worksheet Functions 1 March 13th 05 02:46 AM
match cell text with text in formula Todd L. Excel Worksheet Functions 3 December 9th 04 08:11 PM


All times are GMT +1. The time now is 02:18 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"