Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Sam Johnson   on Aug 11 In MS Office Category.

  
Question Answered By: Josie Roberts   on Aug 11

accidently declared the array  twice - you can drop the first
declaration.

--------------------------------
Sub RemoveDuplicates()

Dim count, totalrows, row  As Integer ' used as a counter
totalrows = ActiveSheet.UsedRange.Rows.count
ReDim SrvNameArry(totalrows) As String
count = 0

For row = totalrows To 2 Step -1
If Cells(row, 1).Value = Cells(row - 1, 1).Value Then
SrvNameArry(count) = Cells(row, 1).Value
count = count  + 1
End If
Next row

End Sub
------------------------------------

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on subscript out of range Or get search suggestion and latest updates.


Tagged: