Each and every details is mentioned in the attachment
highlight duplicate rows with fixed range
- Sholtan
- Closed
- Thread is marked as Resolved.
-
-
-
Re: highlight duplicate rows with fixed range
Hi Sholtan,
Try this macro which is almost an exact copy of the code I gave you from this thread :confused:
Code
Display MoreOption ExplicitSub Macro1() Const lngStartRow As Long = 1 'Starting Row number for the data. Change to suit. Dim lngLastRow As Long Dim lngMyRow As Long Dim xlnCalcMethod As XlCalculation With Application xlnCalcMethod = .Calculation 'Store current calculation method .Calculation = xlCalculationManual 'Set calculation method to manual .ScreenUpdating = False End With 'Note the sheet must have data in it or the next lines will error out!! lngLastRow = Range("B:F").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row 'Copy Primary Key formula down dataset Range(Cells(lngStartRow, "G"), Cells(lngLastRow, "G")).Formula = "=B1&F1" 'Loop through Primary Key field and highlight duplicates For lngMyRow = lngStartRow To lngLastRow If Evaluate("COUNTIF(" & Range("G" & lngStartRow & ":G" & lngStartRow & lngLastRow).Address(True, True) & "," & Range("G" & lngMyRow).Address(False, True) & ")") > 1 Then Range(Cells(lngMyRow, "B"), Cells(lngMyRow, "F")).Interior.Color = RGB(255, 255, 0) 'Highlight duplicates in yellow. Change to suit. End If Next lngMyRow 'Delete helper column Columns("G").EntireColumn.Delete With Application .Calculation = xlnCalcMethod 'Set calculation method to its original setting .ScreenUpdating = True End With MsgBox "Any duplicates have now been highlighted.", vbInformation End Sub
Robert
-
Re: highlight duplicate rows with fixed range
Thnx trebror
-
Re: highlight duplicate rows with fixed range
Trebror can u let me know which type of cpu is best for excel for large files
-
Re: highlight duplicate rows with fixed range
That's a hard question to answer as from Excel 2007 there are so many rows (1,048,576) and columns (16,384) on every tab that a workbook can get bogged down pretty quick on any machine.
-
-
Re: highlight duplicate rows with fixed range
just let me know which type of cpu u used for excel
-
Re: highlight duplicate rows with fixed range
I'm not a hardware expert so I will decline to offer advice as it may not be correct and / or relevant. Thanks.
-
Re: highlight duplicate rows with fixed range
K thnx
-
Re: highlight duplicate rows with fixed range
I am getting run time error 438 from this vba code
-
Re: highlight duplicate rows with fixed range
Not sure as it works perfect on the workbook you posted :confused:
Post the work you're using and I'll have another look.
-
-
Re: highlight duplicate rows with fixed range
Sorry bro thnx
-
Re: highlight duplicate rows with fixed range
Code is working but it is highlighting non duplicates also
-
Re: highlight duplicate rows with fixed range
You'll need to post the workbook you're using so either I or anyone reading this thread will be able to help.
-
Re: highlight duplicate rows with fixed range
See the attachment
-
Re: highlight duplicate rows with fixed range
I will have to have a look tomorrow as it's a bit late in Aus now.
-
-
Re: highlight duplicate rows with fixed range
No problem its ok but tomorrow solve this problem
-
Re: highlight duplicate rows with fixed range
I'm confused - in the first workbook you posted "My row range is fixed B1 TO F1 ,B2 TO F2 AND SO ON SO don’t compare the complete row to each other" so my code only highlights rows where B1 and F1 is duplicated which in the example you posted was with B3 and F3 and you posted sample data across only 5 columns. The second workbook you posted has 8,996 columns. If you want to know which row is duplicated based on each of these 8,996 columns I can't help as I couldn't create a primary key for that many fields.
-
Re: highlight duplicate rows with fixed range
I thought that i just require a code and i will change the range from ur given code but that is not happened so kindly look into this attachment and solve this problem and dont compare complete row means only B to F range compare with other row
-
Re: highlight duplicate rows with fixed range
Quoteif you want to know which row is duplicated based on each of these 8,996 columns i can't help as i couldn't create a primary key for that many fields.
Excel can't handle a formula to join the 8,996 columns needed for my original code (from this post) to work!! There is nothing I can think of to solve your issue. Good luck with it.
-
Re: highlight duplicate rows with fixed range
Bro u have given me the code of a complete row 1 month back but when i am using that code it shows error 7 out of memory so that y i am looking for highlight duplicates row with fixed range my question is simple when u join the complete row into one row so u can join A to MHZ coloumn
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!