Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default use Find without hardcoded value but a value from a cell

Hi

I am trying to search within Excel VBA a value in a sheet dependant on
the entry in another cell. But not sure how to put a paramater as the
What part of the Find.

Can anyone help please?

i.e if cell A1 is Cat then I would search for Cat in the other sheet.

Dim Animalname

AnimalName = Combo1.Value

Sheets("Animals").Select


Cells.Find(What:=Animalname,After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default use Find without hardcoded value but a value from a cell

I think what I may be better doing is using a loop of some sort. I
want to search a named range for the text in a combobox. So Combo1
says "cat" sheet Animals has a list of animals in a named range, say
AnimalType, and i want to search though this range and then stop when
"cat" or whatever animal has been found.

StartPoint is a named range startpoint on "Animals" sheet (say $D$10)

So sort of loop the following:

Worksheets("Animals").Range("StartPoint").Select
If ActiveCell.Value = Animalname Then
ActiveCell.Select
'and somehow exit the loop
Else: ActiveCell.Offset(0, 1).Select

then loop back.

I dont know when it would stop if there was no "cat" listed either.

Any help would be brilliant.

Cheers

Rich

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 & Replace: find part cell, replace whole cell katy Excel Worksheet Functions 3 April 3rd 23 01:20 PM
I need to change hardcoded background color Bridgette Culpepper Excel Worksheet Functions 2 October 25th 07 04:17 PM
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
Inserting "/G50" into hardcoded numbers marksuza Excel Discussion (Misc queries) 7 March 3rd 06 03:21 PM
DSUM with Criteria containing non-hardcoded values? George Davis Excel Worksheet Functions 4 December 13th 05 08:11 PM


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