Hi, try this code somewhere in your sub:

 

With Range(A1:A1000)

    D = "Seed-BOD"
    Set C = .Find(D, LookIn:=xlFormulas)
    If Not C Is Nothing Then MsgBox "Sample is already here."
End With


If you are already using C and/or D as variables, you'll need to change them.

You may need to change the range in the first line.

 

Regards - Dave.
 
> Date: Tue, 5 May 2009 05:03:49 -0700
> Subject: $$Excel-Macros$$ VBA code to search a column for a string
> From: dsrmccl...@gmail.com
> To: excel-macros@googlegroups.com
> 
> 
> Seems easy enough but I'm new at VBA so I can't seem to get it right.
> 
> I have a sub that adds a row to my worksheet but this particular row
> needs to be unique. So all I want to do is call a function that will
> search the first column of the active worksheet for the string "Seed-
> BOD". If it finds the string, it gives a message "Sample is already
> here." If it doesn't find the string then the sub will continue.
> 
> I don't want it to go to where the string is. I just want to confirm
> whether it exists or not.
> 
> Thanks.
> 
> > 

_________________________________________________________________
Looking for a fresh way to share your photos? Check out the new Windows Live 
Messenger
http://windowslive.ninemsn.com.au/article.aspx?id=792335
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to