ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with a vb function (https://www.excelbanter.com/excel-programming/393298-need-help-vbulletin-function.html)

[email protected]

Need help with a vb function
 
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.


JLatham

Need help with a vb function
 
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


" wrote:

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.




All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com