Interogating a string within a Macro
If I have a string called data that contains, for example, 12 characters how
can I find teh position of two charactors within it. e.g the string is : abhhsctdshhd how can I find the position of 'ct' within it ? any suggestions appreciated. brian |
Interogating a string within a Macro
On Tue, 27 Mar 2007 16:08:55 -0700, Brian Young
wrote: If I have a string called data that contains, for example, 12 characters how can I find teh position of two charactors within it. e.g the string is : abhhsctdshhd how can I find the position of 'ct' within it ? any suggestions appreciated. brian InStr Function Returns a Variant (Long) specifying the position of the first occurrence of one string within another. Syntax InStr([start, ]string1, string2[, compare]) --ron |
Interogating a string within a Macro
instr() should do it.
-- Tim Williams Palo Alto, CA "Brian Young" wrote in message ... If I have a string called data that contains, for example, 12 characters how can I find teh position of two charactors within it. e.g the string is : abhhsctdshhd how can I find the position of 'ct' within it ? any suggestions appreciated. brian |
Interogating a string within a Macro
data = "abhhsctdshhd"
MsgBox InStr(data, "ct") Regards, Greg "Brian Young" wrote: If I have a string called data that contains, for example, 12 characters how can I find teh position of two charactors within it. e.g the string is : abhhsctdshhd how can I find the position of 'ct' within it ? any suggestions appreciated. brian |
All times are GMT +1. The time now is 10:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com