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:
Does anyone know how to make this a function that I can put onto my Menu Bar (has Format, Tools, Data, etc..)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
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
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)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks