greykitten
Member
Hello Forum,
I just discovered VBA and I'm trying to write a conditional macro where VBA will add (x) number of rows depending on how many separate numbers appear in a specific cell. However, I can't find any postings that specifically address this scenario. I've attached a generic and fictional example below of how the data appears and how it needs to look like.
Goal: If a cell in column M has multiple cust_numbers, then that row needs to be copied and populated underneath with the next number in that series which would then repeat until each cust_number has its' own row. I am using Excel 2010.
Important Notes: Ideally, all of the customer data that appears in columns A - L and N - onward should all replicate in the rows that are created beneath the first row. The only difference would be the value in column M. Also, all of the account number values will be delimited by a comma that separates them and some of them will vary slightly in length. Last, the total number of rows will vary each month so the ending row would need to be dynamic.
CURRENT FORM:
Column A ......................... Column M
Customer ......................... Cust_Number
Customer_1 ......................... 1111111,2222222,333333333,4444444,555555,666666
DESIRED FORM
Column A ......................... Column M
Customer ......................... Cust_Number
Customer_1 ......................... 1111111
Customer_1 ......................... 2222222
Customer_1 ......................... 333333333
Customer_1 ......................... 4444444
Customer_1 ......................... 555555
Customer_1 ......................... 666666
I have no idea if this can be done but I would be eternally grateful if so
Thank you in advance for your help!
~Eric
I just discovered VBA and I'm trying to write a conditional macro where VBA will add (x) number of rows depending on how many separate numbers appear in a specific cell. However, I can't find any postings that specifically address this scenario. I've attached a generic and fictional example below of how the data appears and how it needs to look like.
Goal: If a cell in column M has multiple cust_numbers, then that row needs to be copied and populated underneath with the next number in that series which would then repeat until each cust_number has its' own row. I am using Excel 2010.
Important Notes: Ideally, all of the customer data that appears in columns A - L and N - onward should all replicate in the rows that are created beneath the first row. The only difference would be the value in column M. Also, all of the account number values will be delimited by a comma that separates them and some of them will vary slightly in length. Last, the total number of rows will vary each month so the ending row would need to be dynamic.
CURRENT FORM:
Column A ......................... Column M
Customer ......................... Cust_Number
Customer_1 ......................... 1111111,2222222,333333333,4444444,555555,666666
DESIRED FORM
Column A ......................... Column M
Customer ......................... Cust_Number
Customer_1 ......................... 1111111
Customer_1 ......................... 2222222
Customer_1 ......................... 333333333
Customer_1 ......................... 4444444
Customer_1 ......................... 555555
Customer_1 ......................... 666666
I have no idea if this can be done but I would be eternally grateful if so

Thank you in advance for your help!
~Eric