I am very new at this so this question may sound elementary but I could really use some help.
I have a code that will be used with another program. One part of the code is variable, the user has to input the ids of the person they will be looking up. Everyday the user will paste new info onto a worksheet. I want to make a button that will make a user form pop up with the code already filled out with all of the variable information.
More Details:
The IDs needed for the code will always be pasted into Column C, starting at row 2. The length will always be different.
I need the column of IDs to be saved into a list, concatenated with commas separating each id. Then I will reference this list in the code so the user doesn't have to manually change the code everyday.
The only thing I am having trouble with (so far) is saving the IDs that are in columns as 1 concatenated string.
I appreciate any help, thanks.
Comments
: could really use some help.
:
: I have a code that will be used with another program. One part of
: the code is variable, the user has to input the ids of the person
: they will be looking up. Everyday the user will paste new info onto
: a worksheet. I want to make a button that will make a user form pop
: up with the code already filled out with all of the variable
: information.
:
: More Details:
: The IDs needed for the code will always be pasted into Column C,
: starting at row 2. The length will always be different.
: I need the column of IDs to be saved into a list, concatenated with
: commas separating each id. Then I will reference this list in the
: code so the user doesn't have to manually change the code everyday.
:
: The only thing I am having trouble with (so far) is saving the IDs
: that are in columns as 1 concatenated string.
:
: I appreciate any help, thanks.
:
:
I assume you're working with some spreadsheet program. You can perform this without needing VBA. With this simple worksheet function you can concatenate the column into a string:
[code]
C D
ID1 =C1
ID2 =D1&","&C2
ID3 =D2&","&C3
ID4 =D3&","&C4
ID5 =D4&","&C5
ID6 =D5&","&C6
[/code]
The concatenated string is listed in the last field.
Here's the code, if you want to adjust for blanks:
[code]
=D1&IF(C2="","",","&C2)
[/code]