Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default using find with variant?

How do you use find statement to find variant? My code:

Activecell.Value = varval
On Error Resume Next
With Sheets("Table").Columns("A:A")
Set c = .Find(What:=varval, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not c Is Nothing Then

Question? Dose varval need to be in quotes? parenthethes? varval is a string.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default using find with variant?

The only problem that I see is that you never set the value of varval. The line
Activecell.Value = varval
sets the active cell to varval, but where is varval set?

--
HTH...

Jim Thomlinson


"Don S" wrote:

How do you use find statement to find variant? My code:

Activecell.Value = varval
On Error Resume Next
With Sheets("Table").Columns("A:A")
Set c = .Find(What:=varval, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not c Is Nothing Then

Question? Dose varval need to be in quotes? parenthethes? varval is a string.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default using find with variant?

This code is inside a loop that changes the "activecell". varval is set to
the value of activecell; i.e it changes throughtout the loop. It could be
"car" on loop 1 and "boat" on loop , etc. I want to use the variant to Seach
sheet Table to pick up other values associated to "varval" from the Table.


"Jim Thomlinson" wrote:

The only problem that I see is that you never set the value of varval. The line
Activecell.Value = varval
sets the active cell to varval, but where is varval set?

--
HTH...

Jim Thomlinson


"Don S" wrote:

How do you use find statement to find variant? My code:

Activecell.Value = varval
On Error Resume Next
With Sheets("Table").Columns("A:A")
Set c = .Find(What:=varval, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not c Is Nothing Then

Question? Dose varval need to be in quotes? parenthethes? varval is a string.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default using find with variant?

Where is varval set. I would understand if you had the line
varval = activecell.value
I just wanted to confirm that varval has a value before you start your find.
--
HTH...

Jim Thomlinson


"Don S" wrote:

This code is inside a loop that changes the "activecell". varval is set to
the value of activecell; i.e it changes throughtout the loop. It could be
"car" on loop 1 and "boat" on loop , etc. I want to use the variant to Seach
sheet Table to pick up other values associated to "varval" from the Table.


"Jim Thomlinson" wrote:

The only problem that I see is that you never set the value of varval. The line
Activecell.Value = varval
sets the active cell to varval, but where is varval set?

--
HTH...

Jim Thomlinson


"Don S" wrote:

How do you use find statement to find variant? My code:

Activecell.Value = varval
On Error Resume Next
With Sheets("Table").Columns("A:A")
Set c = .Find(What:=varval, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not c Is Nothing Then

Question? Dose varval need to be in quotes? parenthethes? varval is a string.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default using find with variant?

Actually I do have that code earlier in my loop. Also, I have figured out my
problem. The find was incorrect because I did not activate a cell on sheet
Table and the search could not search "After:=Activecell". Once I corrected
this my origanl code works fine. THANKS FOR THE HELP.....


"Jim Thomlinson" wrote:

Where is varval set. I would understand if you had the line
varval = activecell.value
I just wanted to confirm that varval has a value before you start your find.
--
HTH...

Jim Thomlinson


"Don S" wrote:

This code is inside a loop that changes the "activecell". varval is set to
the value of activecell; i.e it changes throughtout the loop. It could be
"car" on loop 1 and "boat" on loop , etc. I want to use the variant to Seach
sheet Table to pick up other values associated to "varval" from the Table.


"Jim Thomlinson" wrote:

The only problem that I see is that you never set the value of varval. The line
Activecell.Value = varval
sets the active cell to varval, but where is varval set?

--
HTH...

Jim Thomlinson


"Don S" wrote:

How do you use find statement to find variant? My code:

Activecell.Value = varval
On Error Resume Next
With Sheets("Table").Columns("A:A")
Set c = .Find(What:=varval, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not c Is Nothing Then

Question? Dose varval need to be in quotes? parenthethes? varval is a string.



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
Moving a Variant to Array Ivan Excel Programming 3 August 7th 05 12:42 PM
Find Variant StephanieH Excel Programming 7 February 23rd 05 03:48 PM
Variant as matrix curious Excel Programming 5 June 2nd 04 04:18 PM
Variant Array Steph[_3_] Excel Programming 1 June 2nd 04 01:29 AM
Variant to String Chip Pearson Excel Programming 1 September 3rd 03 03:10 PM


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