ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   STRING MANIPULATION !! (https://www.excelbanter.com/excel-programming/427537-string-manipulation.html)

Jay Dean

STRING MANIPULATION !!
 
Hello !

AA is a variable that contains a string. BB is another string variable.

I need a macro that will create a new string CC which is made by
inserting BB into AA (after the first word in AA).

Example: If AA="They are capable" and BB="think they", then CC should be
"They think they are capable." Any help would be apreciated!

Thanks
Jay



*** Sent via Developersdex http://www.developersdex.com ***

mudraker[_427_]

STRING MANIPULATION !!
 

Heres 1 way


Code:
--------------------

Sub ManipulateText()
Dim AA As String
Dim BB As String
Dim CC As String
Dim iPos As Integer


AA = "They are capable"
BB = "think they"

iPos = InStr(1, AA, " ")
CC = Left(AA, iPos) & BB & Mid(AA, iPos)
MsgBox CC
End Sub

--------------------


--
mudraker

If my reply has assisted or failed to assist you I welcome your
Feedback.

www.thecodecage.com
------------------------------------------------------------------------
mudraker's Profile: http://www.thecodecage.com/forumz/member.php?userid=18
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=90317



All times are GMT +1. The time now is 01:32 AM.

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