View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default correct syntax for LEFT in vba

"Howard" wrote:
What's the correct syntax

[....]
Dim Celln As Range

[....]
If Left(Celln, 2).Value = Range("B15").Value Then
Celln.Interior.ColorIndex = 3
End If


It is sufficient to write:

If Left(Celln, 2) = Range("B15") Then
Celln.Interior.ColorIndex = 3
End If

But if you feel better using .Value explicitly, then:

If Left(Celln.Value, 2) = Range("B15").Value Then
Celln.Interior.ColorIndex = 3
End If