LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Query - Formula (Test for string)

Hi,

Can someone help with the following @ all. I've created the following
VBA which works as expected the first time, however I only want it to
check for the value once, whereas this will add in the prefix more
than once when I run it?

e.g. this is meant to check B4, if this contains CD- don't do anything
if it doesn't add it in.

Any suggestions?

Cheers, Al.

Sub Prefix()
Const Prefix = "CD-"

If Left("B4", 3) = "CD-" Then
Range("B4").Select
ActiveCell.Value = Prefix & ActiveCell.Value
Else
End If
End Sub

 
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
Test String LucB Excel Discussion (Misc queries) 2 November 29th 06 02:49 AM
test if a character in a string is alpha Matilda Excel Programming 7 October 16th 06 02:36 PM
How to test text string to know if it is a date itarnak[_4_] Excel Programming 2 October 7th 05 02:03 PM
Test for exact match in string Jeremy Gollehon[_2_] Excel Programming 3 August 24th 04 12:58 AM
Test a String to see if it begins with a Number Randy[_10_] Excel Programming 3 October 8th 03 12:37 PM


All times are GMT +1. The time now is 04:44 AM.

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"