Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Like, with worksheet- UDF?

Howdee all.
Has anyone ever made a UDF, for Like, to use in a worksheet function?

I.e., look at a string of text in a cell, and see if a given format exists,
to then perform a worksheet operation on that cell's contents, based on its
matching the like operator?

I swear I remember a discussion like this before, but I can't find it.

I am aware that it's not a standard worksheet function. Hence the UDF.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Like, with worksheet- UDF?

You cannot perform a worksheet operation on a cell from within a function,
with or without Like.

--

HTH

Bob

"Steve" wrote in message
...
Howdee all.
Has anyone ever made a UDF, for Like, to use in a worksheet function?

I.e., look at a string of text in a cell, and see if a given format
exists,
to then perform a worksheet operation on that cell's contents, based on
its
matching the like operator?

I swear I remember a discussion like this before, but I can't find it.

I am aware that it's not a standard worksheet function. Hence the UDF.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Like, with worksheet- UDF?

It should be as simple as this...

Function IsLike(TextString As String, Pattern As String) As Boolean
IsLike = TextString Like Pattern
End Function

Note that you can't call the function "Like" because that is a reserved
function name in VB, so you can't name a VB function that; hence, I chose to
call it IsLike. You can use any Like patterns for the Pattern argument.

--
Rick (MVP - Excel)



"Steve" wrote in message
...
Howdee all.
Has anyone ever made a UDF, for Like, to use in a worksheet function?

I.e., look at a string of text in a cell, and see if a given format
exists,
to then perform a worksheet operation on that cell's contents, based on
its
matching the like operator?

I swear I remember a discussion like this before, but I can't find it.

I am aware that it's not a standard worksheet function. Hence the UDF.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Like, with worksheet- UDF?

Of course Bob is right... you cannot perform "worksheet operations" as such,
but my IsLike function can do whatever a normal worksheet function can do.
So, you could do, say, this...

=IF(IsLike(A1,"###"),"A1 has exactly 3 digits", "Wrong number of digits")

You can also use the IsLike function in a Conditional Format in order to,
say, change the cell color if the contents of the cell meets (or doesn't
meet) a certain pattern.

--
Rick (MVP - Excel)



"Rick Rothstein" wrote in message
...
It should be as simple as this...

Function IsLike(TextString As String, Pattern As String) As Boolean
IsLike = TextString Like Pattern
End Function

Note that you can't call the function "Like" because that is a reserved
function name in VB, so you can't name a VB function that; hence, I chose
to call it IsLike. You can use any Like patterns for the Pattern argument.

--
Rick (MVP - Excel)



"Steve" wrote in message
...
Howdee all.
Has anyone ever made a UDF, for Like, to use in a worksheet function?

I.e., look at a string of text in a cell, and see if a given format
exists,
to then perform a worksheet operation on that cell's contents, based on
its
matching the like operator?

I swear I remember a discussion like this before, but I can't find it.

I am aware that it's not a standard worksheet function. Hence the UDF.

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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. [email protected] Excel Discussion (Misc queries) 0 September 22nd 05 04:39 PM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


All times are GMT +1. The time now is 03:38 PM.

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"