View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default How to trim a character from a cell ?

Maybe:

Sub Macro1()

Dim Num1 As Long
Dim Num2 As Long

Num1 = Mid(Range("A1").Value, 2, 255)
Num2 = Mid(Range("B1").Value, 2, 255)

If Num1 Num2 Then Range("A1").Interior.ColorIndex = 36

End Sub

Hope this helps
Rowan

dex wrote:
Hi, I have a macro that compares two numbers from when i scan a
quantity on a part number. And if the first cell is greater than the
second cell, the first cell should highlight a color, which is working
with no problems. But the problem is that everytime I scan a part
number the amount always begins with a "Q" example:Q000003. And it will
always give me the wrong results. The cell will still highlight even
though the first cell is less than the second cell, because of the "Q".

I know this because I've tried putting two numbers without the Q
manually and I always get the right results. Basically, I don't know
the syntax to use the trim method or mid method in vb6. I just need a
method to remove the character "Q" but not the numbers. And would I put
this syntax in my module where I have my macro?


Thanks.