Need help with a vb function

  • Thread starter Thread starter jen_designs
  • Start date Start date
J

jen_designs

I am a newbie at writing macros for excel, so bare with me. I need to
write a macro that looks for a character at the beginning of a line.
If the a certain character exists, lets say capital A, I need to go to
the end of the line and insert another character before the carriage
return.
 
If you're looking at text in a cell (G9 for example's sake)

If Left(Range("G9",1)="A" Then
Range("G9")=Range("G9") & "X"
End if
note that in VB, "A" is not the same as "a".

If you have the text in a variable, as myText, then:
If Left(myText,1)="A" Then
myText=myText & "X"
End if
 

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

Back
Top