Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default remove duplicates using vba

Hello
Sorry if you have seen this post already (I accidently posted it in Excel
Misc), but I wanted to make sure I posted it under the Excel Programming
Group.

I have been trying to Chip Pearsons code to remove duplicates using vba in
Excel. The code works perfectly when I create a macro in Excel and run it.
However I am trying to use this code within the ArcGIS visual basic editor.
I can open the spreadsheet and select a range using the code within ArcGIS
but when I try and incorporate the code for deleting duplicates it give me a
Compile Error: Wrong number of arguments or invalid property assignment. It
hightlights

V = Rng.Cells(r, 1).value as being the source of the error. Any
suggestions. Thanks in advance.



Attached code



Dim appExcel As New Excel.Application



' Set wbook = appExcel.Workbooks.Open("G:\Notification_App\jeff2 .xls")

' Set wsheet = appExcel.Sheets("Sheet1")

appExcel.Workbooks.Open ("G:\Notification_App\jeff2.xls")

appExcel.Visible = False





Dim Col As Integer

Dim r As Long

Dim C As Range

Dim N As Long

Dim V As Variant

Dim Rng As Range



Range("F2:F100").Select



On Error GoTo EndMacro

Application.ScreenUpdating = False

Application.Calculation = xlCalculationManual



Col = ActiveCell.Column



If Selection.Rows.Count 1 Then

Set Rng = Selection

Else

Set Rng = ActiveSheet.UsedRange.Rows

End If



N = 0

For r = Rng.Rows.Count To 1 Step -1

V = Rng.Cells(r, 1).value

If Application.WorksheetFunction.CountIf(Rng.Columns( 1), V) 1 Then

Rng.Rows(r).EntireRow.Delete

N = N + 1

End If

Next r



EndMacro:



Application.ScreenUpdating = True

Application.Calculation = xlCalculationAutomatic


--
quigleyj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default remove duplicates using vba


Try this formula.

Simon.

http://www.exceltip.com/st/Formula_i...range/821.html


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=379024

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default remove duplicates using vba

Thanks for tip Simon. Unfortuantely Im not sure this will do what I want it
to. The code I have works perfectly when ran inside Microsoft Excel, but I
contnue to get errors when I try and use the code in the outside program
(ArcGIS).

quigleyj


"Simon Lloyd" wrote:


Try this formula.

Simon.

http://www.exceltip.com/st/Formula_i...range/821.html


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=379024


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
remove all duplicates? snow Excel Discussion (Misc queries) 3 June 2nd 10 09:54 AM
Remove duplicates jennifer Excel Worksheet Functions 2 August 28th 09 07:26 PM
remove duplicates BlindShelter Excel Discussion (Misc queries) 2 December 19th 08 08:45 PM
Remove Duplicates dk New Users to Excel 15 March 28th 08 07:41 AM
Remove duplicates Tuttamay77 Excel Discussion (Misc queries) 4 May 12th 06 10:56 PM


All times are GMT +1. The time now is 08:00 AM.

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"