Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default FindMethod 2 col range


Hi Group,

Have the code below. The names I´am looking for are in Range("E1:E50") and
could
appear at least two times in the range. To not only find the first name
selected in
Textbox1 I also need to check the values in Range("F1:F50") to find an
exclusive
value. The value to find in the later range is in ComboBox1.
Is it possible to do this with the Find method?

Brgds

CG Rosén

Dim z

With Sheets("constants").Range("E1:E50")
Set z = .Find(TextBox1.Text, LookIn:=xlValues, SearchOrder:=xlByColumns)

If z Is Nothing Then

code......

Else

code........

End If
End With



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default FindMethod 2 col range

Dim z as Range, bFnd as Boolean
Dim fAddr as String

With Sheets("constants").Range("E1:E50")
Set z = .Find(TextBox1.Text, LookIn:=xlValues, SearchOrder:=xlByColumns)
bFnd = False
If z Is Nothing Then
msgbox Textbox1.Text & " is not found"

Else
if z.offset(0,1).Value = Combobox1.Value then
z.Select
bFnd = True
msgbox Textbox1.Text & " is found at " & z.address
else
fAddr = z.address
Do
set z =.FindNext(z)
if z.offset(0,1).Value = Combobox1.Value then
z.select
bFnd = True
msgbox Textbox1.Text & " is found at " & z.address
exit do
End if
Loop until z.address = fAddr
End if
if not bFnd then msgbox Textbox1.Text & " not found next to " & _
Combobox1.Value
End If
End With

--
Regards,
Tom Ogilvy


"CG Rosén" wrote in message
...

Hi Group,

Have the code below. The names I´am looking for are in Range("E1:E50") and
could
appear at least two times in the range. To not only find the first name
selected in
Textbox1 I also need to check the values in Range("F1:F50") to find an
exclusive
value. The value to find in the later range is in ComboBox1.
Is it possible to do this with the Find method?

Brgds

CG Rosén

Dim z

With Sheets("constants").Range("E1:E50")
Set z = .Find(TextBox1.Text, LookIn:=xlValues, SearchOrder:=xlByColumns)

If z Is Nothing Then

code......

Else

code........

End If
End With





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default FindMethod 2 col range

Hi Tom,

Many thanks, could never found out this myself but I´am learning.

Brgds

CG Rosén


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
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
FindMethod-DateValues CG Rosén Excel Programming 1 December 8th 03 08:08 PM
find worksheet by FindMethod CG Rosén Excel Programming 3 December 6th 03 09:47 PM
Range in FindMethod? CG Rosén Excel Programming 1 November 12th 03 05:32 PM


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