Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I test for the first character


I have a formula In cell A1 that has the value MP.
If the Value in cell A2 begins with the letter A I want a userform t
pop up. I've tried this and it does not work:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$2" Then
If Range("A1").Value = "MP" Then
If Left("A2", 1) = ("A*") Then
CheckTool.Show
End If
End If
End If
End Sub

Any ideas

--
Kevla
-----------------------------------------------------------------------
Kevlar's Profile: http://www.excelforum.com/member.php...nfo&userid=723
View this thread: http://www.excelforum.com/showthread.php?threadid=26522

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I test for the first character


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$2" Then
If Range("A1").Value = "MP" Then
If Left("A2", 1) = "A" Then
CheckTool.Show
End If
End If
End If
End Sub

--
Regards,
Tom Ogilvy


"Kevlar" wrote in message
...

I have a formula In cell A1 that has the value MP.
If the Value in cell A2 begins with the letter A I want a userform to
pop up. I've tried this and it does not work:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$2" Then
If Range("A1").Value = "MP" Then
If Left("A2", 1) = ("A*") Then
CheckTool.Show
End If
End If
End If
End Sub

Any ideas?


--
Kevlar
------------------------------------------------------------------------
Kevlar's Profile:

http://www.excelforum.com/member.php...fo&userid=7231
View this thread: http://www.excelforum.com/showthread...hreadid=265222



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I test for the first character


Get rid of the * after the A. You will only run the code when the firs
character in cell A2 is A* (which can never happen since that is tw
characters).



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26522

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How do I test for the first character

change line 3 to read If LEFT(A2,1)="A" then....


"A2" is a string, not a cell reference, remove quotes
The value you are checking (the leftmost one character in cell A2) cannot
possibly equal the two character string "A*". Sorry, the pattern match
character doesn't work this way in Excel.

Steve
"Kevlar" wrote in message
...

I have a formula In cell A1 that has the value MP.
If the Value in cell A2 begins with the letter A I want a userform to
pop up. I've tried this and it does not work:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$2" Then
If Range("A1").Value = "MP" Then
If Left("A2", 1) = ("A*") Then
CheckTool.Show
End If
End If
End If
End Sub

Any ideas?


--
Kevlar
------------------------------------------------------------------------
Kevlar's Profile:
http://www.excelforum.com/member.php...fo&userid=7231
View this thread: http://www.excelforum.com/showthread...hreadid=265222



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
Test left character is a number? nastech Excel Discussion (Misc queries) 7 October 5th 15 06:05 PM
problem with test to columns feature identifying odd delimiting character mark_jm via OfficeKB.com Excel Discussion (Misc queries) 4 May 4th 10 11:22 AM
How to test if the end character of a string is within a user-definedlist? T2net Excel Discussion (Misc queries) 8 February 26th 08 01:43 PM
Elimination of "box character" at end of test line Jim May Excel Discussion (Misc queries) 3 February 14th 06 01:16 PM
Test for Single Character That is in an Array scallyte Excel Worksheet Functions 2 November 11th 04 04:47 PM


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