#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie


Anyone,

I'm trying to create a macro to automatic a tedious task. I need help
with a macro to concentatenate a string.

For example, I have a list of usercodes:

Column
A

nx109
px205
px206
qx123

I want to add the usercodes to a string that reads like this.

sp_addexternlogin SQL_PROD, wr_",nx109,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px205,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px206,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",qx123,", trust_user , trustuser"
go

Please Help
Kenworld


--
kenworld
------------------------------------------------------------------------
kenworld's Profile: http://www.excelforum.com/member.php...o&userid=24543
View this thread: http://www.excelforum.com/showthread...hreadid=381377

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Newbie


Dim iLastRow As Long
Dim i As Long
Dim sTemp As String

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
sTemp = sTemp & "sp_addexternlogin ""," & Cells(i, "A").Value & _
",""," & " trust_user , trustuser" & vbNewLine & _
"go" & vbNewLine
Next i
MsgBox sTemp


--

HTH

RP
(remove nothere from the email address if mailing direct)


"kenworld" wrote in
message ...

Anyone,

I'm trying to create a macro to automatic a tedious task. I need help
with a macro to concentatenate a string.

For example, I have a list of usercodes:

Column
A

nx109
px205
px206
qx123

I want to add the usercodes to a string that reads like this.

sp_addexternlogin SQL_PROD, wr_",nx109,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px205,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px206,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",qx123,", trust_user , trustuser"
go

Please Help
Kenworld


--
kenworld
------------------------------------------------------------------------
kenworld's Profile:

http://www.excelforum.com/member.php...o&userid=24543
View this thread: http://www.excelforum.com/showthread...hreadid=381377



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie


Thanks for your response, I'll give this a shot.

Kenworl

--
kenworl
-----------------------------------------------------------------------
kenworld's Profile: http://www.excelforum.com/member.php...fo&userid=2454
View this thread: http://www.excelforum.com/showthread.php?threadid=38137

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
Help for a newbie? rehr0001 Excel Worksheet Functions 4 August 18th 05 05:13 AM
JET dB Newbie Needs Help Trip Excel Discussion (Misc queries) 0 August 15th 05 07:02 PM
Newbie needs help in VBA david2004 Excel Programming 0 January 8th 04 09:04 PM
Newbie needs help MarkJones Excel Programming 5 November 27th 03 02:47 PM


All times are GMT +1. The time now is 05:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"