MEUserII
Board Regular
- Joined
- Oct 27, 2017
- Messages
- 91
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- Platform
- Windows
I am looking to see if anyone might have a macro for data that has blank rows inserted between data?
For example beginning with this:
[TABLE="width: 100"]
<tbody>[TR]
[TD][/TD]
[TD]Column_A[/TD]
[TD]Column_B[/TD]
[TD]Column_C[/TD]
[TD]Column_D[/TD]
[TD]Colum_E[/TD]
[/TR]
[TR]
[TD]Row_1[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_2[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_3[/TD]
[TD]GAMMA[/TD]
[TD]KIWI[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_4[/TD]
[TD]DELTA[/TD]
[TD]COCONUT[/TD]
[TD]JKL[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_5[/TD]
[TD]ECHO[/TD]
[TD]LIME[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_6[/TD]
[TD]FRANK[/TD]
[TD]LEMO[/TD]
[TD]PQR[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I use the following insert blank rows macro to insert three blank rows:
And now need to copy the data from each "data row" to the blank rows inserted to end up with the following:
[TABLE="width: 100"]
<tbody>[TR]
[TD][/TD]
[TD]Column_A[/TD]
[TD]Column_B[/TD]
[TD]Column_C[/TD]
[TD]Column_D[/TD]
[TD]Colum_E[/TD]
[/TR]
[TR]
[TD]Row_1[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_2[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_3[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_4[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_5[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_6[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_7[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_8[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
What macro would I use to be able to do this?
For example beginning with this:
[TABLE="width: 100"]
<tbody>[TR]
[TD][/TD]
[TD]Column_A[/TD]
[TD]Column_B[/TD]
[TD]Column_C[/TD]
[TD]Column_D[/TD]
[TD]Colum_E[/TD]
[/TR]
[TR]
[TD]Row_1[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_2[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_3[/TD]
[TD]GAMMA[/TD]
[TD]KIWI[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_4[/TD]
[TD]DELTA[/TD]
[TD]COCONUT[/TD]
[TD]JKL[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_5[/TD]
[TD]ECHO[/TD]
[TD]LIME[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_6[/TD]
[TD]FRANK[/TD]
[TD]LEMO[/TD]
[TD]PQR[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I use the following insert blank rows macro to insert three blank rows:
Code:
Sub INSERTBLANKROWS()
Dim j As Long
Dim r As Range
j = InputBox("Enter the number of rows to be inserted")
Set r = Range("A1")
Do While r.Value <> ""
Set r = r.Offset(1, 0)
For i = 1 To j
r.EntireRow.Insert
Next
Loop
End Sub
And now need to copy the data from each "data row" to the blank rows inserted to end up with the following:
[TABLE="width: 100"]
<tbody>[TR]
[TD][/TD]
[TD]Column_A[/TD]
[TD]Column_B[/TD]
[TD]Column_C[/TD]
[TD]Column_D[/TD]
[TD]Colum_E[/TD]
[/TR]
[TR]
[TD]Row_1[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_2[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_3[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_4[/TD]
[TD]ALPHA[/TD]
[TD]APPLE[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_5[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_6[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_7[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Row_8[/TD]
[TD]BETA[/TD]
[TD]ORANGE[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
What macro would I use to be able to do this?
Last edited: