Often I need to paste lists of numbers into SQL server from Excel for an 'In' statement of a 'where' clause. In order for SQL server to recognize them they need to be formatted like this " '123456' ". Also, I will need to place a comma at the end of each number except the last one, so the where statement works. This will change the format to this " '123456', " on all but the final number. So, the code needs to work for all lists with 1 or more numbers.
I see the process of events happening thusly:
- Select number at the top of the list
- Execute code that will:
- Apply formatting described above, but in a new column, so originals aren't effected
- Copy formatted values to clipboard
- Delete new column with formatted values assuming everything goes well
I think I could use excel's record macro feature to figure a lot of this out, but it would be rather sloppy. Any help is appreciated!
Bookmarks