LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Lookup second duplicate value location.

Marina,

You don't need VB for this it can be done with a formula but if you want code

Sub sonic()
Dim Found As Long, x As Long, LastRow As Long
Dim ResPonse As String
ResPonse = Trim(InputBox("Enter value to search for"))
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
For x = LastRow To 1 Step -1
If UCase(Trim(Cells(x, 1).Value)) = UCase(ResPonse) Then
Found = Found + 1
If Found = 2 Then
MsgBox "second occurrence of " & ResPonse & " in row " & x
Exit Sub
End If
End If
Next
MsgBox "Search string not found"
End Sub

Mike

"Marina" wrote:

How to write VBA code to find the row location of a second duplicate
value in a list( ie a second "apple" in a list of fruits name) ?
.

 
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
lookup duplicate value :)[_2_] Excel Discussion (Misc queries) 7 February 16th 10 01:37 AM
Lookup a location # with multiple dates Andrea Excel Worksheet Functions 2 November 9th 09 09:56 PM
Fixed file location for lookup formula Code Numpty Excel Worksheet Functions 4 April 19th 08 04:02 PM
Duplicate Lookup smandula Excel Programming 4 July 5th 05 01:05 AM
lookup cell location joe smith[_2_] Excel Programming 1 February 9th 04 10:55 PM


All times are GMT +1. The time now is 05:59 AM.

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

About Us

"It's about Microsoft Excel"