Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Find value in range

Hi all,
I'm looking for an efficient way to find the row in a sheet with a matching
value in column A to a textbox value on a userform.

The userform is used to gather record information from the user and update
the spreadsheet. The spreadsheet can accumulate upwards of 100+ records and
the user form is the only way to navigate the data - I need a way to "jump"
to a specific record. The txtActivityNo would be the unique record identifier.

help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Find value in range

Give this a try...

Sub FindActivityNumber()
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Columns("A")
Set rngFound = rngToSearch.Find(What:=txtActivityNo, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry " & txtActivityNo & " was not found."
Else
wksToSearch.Select
rngFound.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"TimT" wrote:

Hi all,
I'm looking for an efficient way to find the row in a sheet with a matching
value in column A to a textbox value on a userform.

The userform is used to gather record information from the user and update
the spreadsheet. The spreadsheet can accumulate upwards of 100+ records and
the user form is the only way to navigate the data - I need a way to "jump"
to a specific record. The txtActivityNo would be the unique record identifier.

help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Find value in range

BRILLIANT!!!!
Works perfectly, thank you!

"Jim Thomlinson" wrote:

Give this a try...

Sub FindActivityNumber()
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Columns("A")
Set rngFound = rngToSearch.Find(What:=txtActivityNo, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry " & txtActivityNo & " was not found."
Else
wksToSearch.Select
rngFound.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"TimT" wrote:

Hi all,
I'm looking for an efficient way to find the row in a sheet with a matching
value in column A to a textbox value on a userform.

The userform is used to gather record information from the user and update
the spreadsheet. The spreadsheet can accumulate upwards of 100+ records and
the user form is the only way to navigate the data - I need a way to "jump"
to a specific record. The txtActivityNo would be the unique record identifier.

help?

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
Find Last cell in Range when range is date format default105 Excel Discussion (Misc queries) 5 July 7th 09 03:11 PM
Find a range of values in a range of cells Jack Taylor Excel Worksheet Functions 20 November 25th 06 01:26 PM
Find the POSITION IN A RANGE of text in a string that matches value(s) in a range Cornell1992 Excel Programming 0 March 14th 06 07:19 PM
Find dates in a range; then sum values in that range by a criteria Anders Excel Discussion (Misc queries) 4 October 21st 05 03:41 PM
Find first cell in range and expand range -VBA Caméléon Excel Programming 3 December 4th 04 02:01 AM


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