+ Reply to Thread
Results 1 to 2 of 2

Thread: *Add-In Help* Need help to make code into Add-In - List work

  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    73

    *Add-In Help* Need help to make code into Add-In - List work

    Hi guys,

    I made some code to turn a list on Excel into something useable in SQL
    What it does in an example:

    (BEFORE MACRO)
    A B
    1 A
    2 D
    3 G
    4 J
    5 M

    (AFTER MACRO)
    A B
    1 A 'A','D','G','J','M'
    2 D
    3 G
    4 J
    5 M

    the code is here:
    str = "'"
    i = 1
    cnt = 1
    
    Do While Range("A" & cnt).Value <> ""
        cnt = cnt + 1
    Loop
    cnt = cnt - 1
    
    Do While Range("A" & i).Value <> ""
    
        If i < cnt Then
            str = str & "'" & Range("A" & i).Value & "',"
        ElseIf i = cnt Then
            str = str & "'" & Range("A" & i).Value & "'"
        End If
    
        i = i + 1
    Loop
    
    Range("B1").Value = str
    Does anyone know how to make this a function that I can put onto my Menu Bar (has Format, Tools, Data, etc..)

    Also, would anyone know how to make this into a tool I could just select a list anywhere and it'd create the list somewhere beside or below the selected area?

    Thanks very much in advance!
    -Torontoguy

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: *Add-In Help* Need help to make code into Add-In - List work

    You can add a menu or toolbar with the examples here

    Make sure the code works on any sheet or range then save it as an addin (*.xla)
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0