Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Searching a column

Help please !!

Last week I posted this as follows;

""I would like to search a column of data for 'part
characters' : eg user enters "lock" and macro searches
column A and comes up with "block" in cell A6 and "locket"
in cell A9. I am thinking this might incorporate the use
of the LEN command, but without writing an immense amount
of code I am sure there must be a more simpler and more
efficient method.""

And I received the following reply;

"You will need to set SearchValue to the user input.
With Range("A:A")
Set rng = .Find(SearchValue, LookIn:=xlValues,
LookAt:=xlPart)""

Well I have been really struggling ! Can anyone please
send me a brief example of how I approach the code

Ever so grateful
Robert Pollock.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Searching a column

If you're new to VBA then...

Generally, you'll use standard code modules to save your
code. To get to a standard module open the IDE (Alt+F11)
the in the project ad a standard module ...
OR
create a simple macro using th emacro recorder. Then,
under too macros...got to the macro you recorded by
clicking on the Edit button.
This will take you to a standard module that Excel will
have added for you.

Now you should be able to add a "macro" or procedure
yourself...

Public Sub FindCells()
' you code
End Sub


I suspect that your reult could be achived using several
other methods.
For example, you could use conditional formatting to
highlight cells that contain certain letters. You could
use an AutoFilter to show cells containing that text or
you use an Advanced filter to copy rows to another
location.

HTH
Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Help please !!

Last week I posted this as follows;

""I would like to search a column of data for 'part
characters' : eg user enters "lock" and macro searches
column A and comes up with "block" in cell A6

and "locket"
in cell A9. I am thinking this might incorporate the use
of the LEN command, but without writing an immense

amount
of code I am sure there must be a more simpler and more
efficient method.""

And I received the following reply;

"You will need to set SearchValue to the user input.
With Range("A:A")
Set rng = .Find(SearchValue, LookIn:=xlValues,
LookAt:=xlPart)""

Well I have been really struggling ! Can anyone please
send me a brief example of how I approach the code

Ever so grateful
Robert Pollock.



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Searching a column

Just to add, look at the help example for the FindNext method using help in
VBA.

--
Regards,
Tom Ogilvy

"Patrick Molloy" wrote in message
...
If you're new to VBA then...

Generally, you'll use standard code modules to save your
code. To get to a standard module open the IDE (Alt+F11)
the in the project ad a standard module ...
OR
create a simple macro using th emacro recorder. Then,
under too macros...got to the macro you recorded by
clicking on the Edit button.
This will take you to a standard module that Excel will
have added for you.

Now you should be able to add a "macro" or procedure
yourself...

Public Sub FindCells()
' you code
End Sub


I suspect that your reult could be achived using several
other methods.
For example, you could use conditional formatting to
highlight cells that contain certain letters. You could
use an AutoFilter to show cells containing that text or
you use an Advanced filter to copy rows to another
location.

HTH
Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Help please !!

Last week I posted this as follows;

""I would like to search a column of data for 'part
characters' : eg user enters "lock" and macro searches
column A and comes up with "block" in cell A6

and "locket"
in cell A9. I am thinking this might incorporate the use
of the LEN command, but without writing an immense

amount
of code I am sure there must be a more simpler and more
efficient method.""

And I received the following reply;

"You will need to set SearchValue to the user input.
With Range("A:A")
Set rng = .Find(SearchValue, LookIn:=xlValues,
LookAt:=xlPart)""

Well I have been really struggling ! Can anyone please
send me a brief example of how I approach the code

Ever so grateful
Robert Pollock.



.



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
Searching only one column in Excel falcios Excel Discussion (Misc queries) 1 March 18th 09 03:34 PM
Searching up a column Mike Rogers[_2_] Excel Discussion (Misc queries) 7 December 31st 07 03:46 PM
Searching One Column Only [email protected] Excel Discussion (Misc queries) 2 August 31st 06 12:17 PM
Searching a Column ToddG Excel Programming 3 June 14th 04 08:51 PM
Searching In a Column KC[_3_] Excel Programming 4 April 15th 04 02:54 PM


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