Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Search column

I want to be able to type in a surname in a textbox called "surname" and I
want to see if there are any matches to this name on the sheet called
"FULLNAMES" column A.


Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Search column

Try this:

Sub colsearch()
Dim s As String
s = Application.InputBox(prompt:="enter name", Type:=2)
listt = ""
With Sheets("FULLNAMES")
n = .Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
v = .Cells(i, 1).Value
If Len(v) = Len(Replace(v, s, "")) Then
Else
listt = listt & Chr(10) & i
End If
Next
End With
If listt = "" Then
MsgBox ("not found")
Else
MsgBox ("found in rows:" & listt)
End If
End Sub

--
Gary''s Student - gsnu2007a


"Greg B" wrote:

I want to be able to type in a surname in a textbox called "surname" and I
want to see if there are any matches to this name on the sheet called
"FULLNAMES" column A.


Thanks

Greg



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
Search for a column based on the column header and then past data from it to another column in another workbook minkokiss Excel Programming 2 April 5th 07 01:12 AM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Programming 2 December 30th 06 06:23 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
Loop through column headers to search from column name and get cell range Pie Excel Programming 9 December 29th 05 12:17 AM
URGENT -- search in string for a value in another column, if found, return value from next column samkshah Excel Programming 4 October 3rd 05 04:13 PM


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