Recgnizing signs 2

K

Ksenija

Hi again,

I have a lots of cells with different values in them. Mostly it is just
numbers, but sometimes I have <0.30 for example. I am writing a macro in VB,
and I want the cells where the value starts with < to change colour. My
problem is that I cant figure out how to write the program so it can choose
cells where the value starts with <.

How should I do it??

I got the answer to do like this:
Either

if left(Range("A1"),1) = "<" then

or
Mystring = "<ABC"
if Left(MyString,1) = "<" then


but I am very new at this so I can't make it work anyway.. I want it to
look through cells say A1:AA200..
 
P

Per Jessen

Hi

Look at this:

Sub AAA()
Set TargetRange = Range("A1:AA200")
For Each cell In TargetRange
If Left(cell.Value, 1) = "<" Then
'Your code
End If
Next
End Sub

Regards,
Per
 
K

Ksenija

Thanks:)!

But now I have a second question, what should I write if I want all these
cells that begin with < to become green or some other color????



"Per Jessen" skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top