Forum Discussion
Kenechukwu_Oraelosi
Sep 20, 2022Copper Contributor
How to loop adding a column with row numbers beside each column in a dynamic range in Excel 2013
Good day. Been on this for more than a week and can't find a solution. New to VBA. I have a data sheet with multiple columns of data. I would like to add, beside each column, a column with the row n...
DexterG_III
Sep 20, 2022Iron Contributor
Kenechukwu_Oraelosi hello, I do not see either of the pics mentioned attached. Please kindly provide so that the community can visualize your intent.
Thank you,
Dexter
Kenechukwu_Oraelosi
Sep 20, 2022Copper Contributor
New here. How do i add pictures?
- DexterG_IIISep 20, 2022Iron Contributor
you should be able paste (or drag & drop as shown below) directly into these message boxes.
- Kenechukwu_OraelosiSep 20, 2022Copper ContributorHi Dexter, i finally found a way to add images, as links. Please see the edited post. Would really be grateful for your help
- DexterG_IIISep 20, 2022Iron Contributor
The quick and dirty way to accomplish this with one formula (Requires Excel 365) is:
=CHOOSECOLS(HSTACK(TRANSPOSE(MOD(SEQUENCE(3,ROWS(A1:C28),1,1)-1,ROWS($A$1:$C$28)))+1,A1:C28),{4,1,5,2,6,3})
I know there's a way to clean this up and account for the different range sizes but wanted to get something to you which was directionally correct to get you started.
- Kenechukwu_OraelosiSep 20, 2022Copper ContributorI'm currently using my phone, an Android