+ Reply to Thread
Results 1 to 3 of 3

Newbie

  1. #1
    Registered User
    Join Date
    06-22-2005
    Posts
    2

    Angry 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

  2. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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. #3
    Registered User
    Join Date
    06-22-2005
    Posts
    2

    Cool Thanks, I'll give this a try

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

    Kenworld

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1