Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default correct syntax for LEFT in vba

On Sunday, September 30, 2012 9:41:44 PM UTC-7, Howard wrote:
Excel 2010

These two lines of code from Help work fine to return "Alp".



Dim LResult As String

LResult = Left("Alphabet",3)



What's the correct syntax to get my IF - THEN line of code to look at each Celln in range NumToColor and if the Left two characters in Celln = Range("B15") then apply ColorIndex 3.



Dim Celln As Range

Dim NumToColor As Range

Set NumToColor = Range("D14:M23")



For Each Celln In NumToColor

Celln.Interior.ColorIndex = xlNone

If Left(Celln, 2).Value = Range("B15").Value Then

Celln.Interior.ColorIndex = 3

End If

Next



Thanks.

Regards,

Howard


Hi joeu,
Good info, thanks a lot, I appreciate it.

Regards,
Howard
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
CORRECT SYNTAX FOR RUN... [email protected] Excel Programming 2 August 19th 06 12:39 AM
CORRECT SYNTAX FOR RUN... [email protected] Excel Programming 3 August 18th 06 09:29 PM
Correct VBA syntax Ken G. Excel Discussion (Misc queries) 3 December 7th 05 12:35 AM
If...and... - can never get the syntax correct! Darin Kramer Excel Programming 12 March 24th 05 04:18 PM
Can't get this syntax correct, please help. Sharlene England Excel Programming 4 December 1st 03 05:41 PM


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