luizblink182
asked on
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!
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!
ASKER
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 =)
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 =)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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?
For exporting delimited text files, I like using this little add-in I created:
http://vbaexpress.com/kb/getarticle.php?kb_id=805
http://vbaexpress.com/kb/getarticle.php?kb_id=805
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