stacking in Excel using VBA

carambo

New Member
Joined
Apr 1, 2009
Messages
1
I would like to try to use my Function I have been using in Excel in a VBA code to do stacking in EXCEL. I have some data that is coming out of a program in a formate that is not usable and needs to be reformated.

The function I use is

=OFFSET($B$1,MOD(ROWS($A$1:A1)-1,11),INT((ROWS($A$1:A1)-1)/11))

The data I get is

Sample Pct LC
100.2
99.9
97.8
99.8
Sample Pct LC (2)
100.9
97.5
97.4
98.3
Sample Pct LC (3)
99.2
98.8
96.2
101.3
Sample Pct LC (4)
99.4
99.2
97.8
100.0
Sample Pct LC (5)
96.6
100.0
98.1
101.7
Sample Pct LC (6)
99.9
99.3
99.5
98.2
Sample Pct LC (7)
100.6
99.0
98.7
97.8
Sample Pct LC (8)
99.6
100.3
97.9
100.3
Sample Pct LC (9)
99.0
100.7
97.5
98.8
Sample Pct LC (10)
100.6
98.4
98.1
97.8
NA
NA
NA
NA
4B20
4B23
4B28
4B29

<tbody>
</tbody>



I then need to take some of the data and copy and transpose it then insert 11 blank lines.

4B20
4B23
4B28
4B29

<tbody>
</tbody>
I then copy the function above into column B next to the first number and pull it down to the last blank line to stack all the rest of the numbers into a formate that I can use. (See below) (I insert NA to allow me to later remove it so I have a blank line between each stack of numbers) I would like to do all this with VBA code but don't even know where to start or how to translate the function into VBA code so any help would be greatly appreciated...

4B20
100.1977
100.8927
99.24877
99.42519
96.58111
99.90633
100.5639
99.59358
99.00018
100.5906
NA
99.89981
4B23
97.4644
98.82834
99.15802
100.0035
99.26171
98.95064
100.3093
100.7426
98.38167
NA
4B28
97.77127
97.42067
96.2485
97.81313
98.0617
99.48243
98.7472
97.92826
97.46515
98.0617
NA
4B29
99.75789
98.27332
101.322
101.322
101.322
101.322
98.0617
98.0617
98.0617
NA

<tbody>
</tbody>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,875
Messages
6,122,039
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top