Evaluating if a cell begins with a specific character

I have a list with several values in a excel sheet.

All I need to do is create a macro that checks if the cell begins with #, and if it does insert a "=" sign on row B.

If the "=" sign is already in roll B, do nothing.

How can I do that? Thank you very much!
luizblink182Asked:
Who is Participating?
 
Rory ArchibaldCommented:
You need:
If Left$(Plan2.Range("A" & line),1) = "#" Then

HTH
Rory
0
 
Patrick MatthewsCommented:
Row B?

This sub will go through the currently selected range and make the change:

Sub foo()

    Dim cel As Range
   
    For Each cel In Selection.Cells
        If Left(cel, 1) = "#" Then cel = "=" & Mid(cel, 2)
    Next
   
End Sub
0
 
luizblink182Author Commented:
Yeah I meant column B :-D

I didn't understand your code, what I was thinking of was something like this:

   For line = 1 To 10
       If Plan2.Range("A" & line) = (THIS IS THE PART I DON'T KNOW HOW TO DO) "BEGINS WITH #" Then
            Plan2.Range("B" & line).Value = "="
       End If
   Next

the rest I can do =)
0
 
luizblink182Author Commented:
That's it rorya =)

Thank you very much. Is there anyway somebody would just help me out exporting everything to a text file (without any tabs) using a macro?
0
 
Patrick MatthewsCommented:
For exporting delimited text files, I like using this little add-in I created:

http://vbaexpress.com/kb/getarticle.php?kb_id=805
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.