Hi, Can anyone help on the below macro code.
I have the data like below,
[TABLE="width: 175"]
<tbody>[TR]
[TD]Name[/TD]
[TD]ABC[/TD]
[/TR]
[TR]
[TD]Model[/TD]
[TD]DEF[/TD]
[/TR]
[TR]
[TD]City[/TD]
[TD]GHI[/TD]
[/TR]
[TR]
[TD]Place[/TD]
[TD]JKL[/TD]
[/TR]
[TR]
[TD]KM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Condition[/TD]
[TD]MNO[/TD]
[/TR]
[TR]
[TD]1st Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2nd Owner[/TD]
[TD]PQR[/TD]
[/TR]
[TR]
[TD]3rd Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Price[/TD]
[TD]STU[/TD]
[/TR]
[TR]
[TD]Delivered[/TD]
[TD]11111111[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]XYZ[/TD]
[/TR]
[TR]
[TD]Model[/TD]
[TD]DJFHA[/TD]
[/TR]
[TR]
[TD]City[/TD]
[TD]SAHJA[/TD]
[/TR]
[TR]
[TD]Place[/TD]
[TD]SHJ[/TD]
[/TR]
[TR]
[TD]KM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Condition[/TD]
[TD]SAFH[/TD]
[/TR]
[TR]
[TD]1st Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2nd Owner[/TD]
[TD]SAHJA[/TD]
[/TR]
[TR]
[TD]3rd Owner[/TD]
[TD]FGH[/TD]
[/TR]
[TR]
[TD]Price[/TD]
[TD]DJFHA[/TD]
[/TR]
[TR]
[TD]Delivered[/TD]
[TD]11111111[/TD]
[/TR]
</tbody>[/TABLE]
and the result should come as below,
[TABLE="width: 790"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Model[/TD]
[TD]City[/TD]
[TD]Place[/TD]
[TD]KM[/TD]
[TD]Condition[/TD]
[TD]1st Owner[/TD]
[TD]2nd Owner[/TD]
[TD]3rd Owner[/TD]
[TD]Price[/TD]
[TD]Delivered[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]DEF[/TD]
[TD]GHI[/TD]
[TD]JKL[/TD]
[TD="align: right"]20[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD]PQR[/TD]
[TD][/TD]
[TD]STU[/TD]
[TD="align: right"]11111111[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]DJFHA[/TD]
[TD]SAHJA[/TD]
[TD]SHJ[/TD]
[TD="align: right"]5[/TD]
[TD]SAFH[/TD]
[TD][/TD]
[TD]SAHJA[/TD]
[TD]FGH[/TD]
[TD]DJFHA[/TD]
[TD="align: right"]11111111
[/TD]
[/TR]
</tbody>[/TABLE]
I wrote a code as,
Sub Macro3()
'
' Macro3 Macro
' extraction
'
' Keyboard Shortcut: Ctrl+i
'
Range("B1:B11").Select
Selection.Copy
ActiveSheet.Next.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
ActiveSheet.Previous.Select
Range("B13:B23").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Next.Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
It is taking only the particular range, but i have N number of data and it will get added more in future.
Can anyone help on this.
Thanks.
I have the data like below,
[TABLE="width: 175"]
<tbody>[TR]
[TD]Name[/TD]
[TD]ABC[/TD]
[/TR]
[TR]
[TD]Model[/TD]
[TD]DEF[/TD]
[/TR]
[TR]
[TD]City[/TD]
[TD]GHI[/TD]
[/TR]
[TR]
[TD]Place[/TD]
[TD]JKL[/TD]
[/TR]
[TR]
[TD]KM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Condition[/TD]
[TD]MNO[/TD]
[/TR]
[TR]
[TD]1st Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2nd Owner[/TD]
[TD]PQR[/TD]
[/TR]
[TR]
[TD]3rd Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Price[/TD]
[TD]STU[/TD]
[/TR]
[TR]
[TD]Delivered[/TD]
[TD]11111111[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]XYZ[/TD]
[/TR]
[TR]
[TD]Model[/TD]
[TD]DJFHA[/TD]
[/TR]
[TR]
[TD]City[/TD]
[TD]SAHJA[/TD]
[/TR]
[TR]
[TD]Place[/TD]
[TD]SHJ[/TD]
[/TR]
[TR]
[TD]KM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Condition[/TD]
[TD]SAFH[/TD]
[/TR]
[TR]
[TD]1st Owner[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2nd Owner[/TD]
[TD]SAHJA[/TD]
[/TR]
[TR]
[TD]3rd Owner[/TD]
[TD]FGH[/TD]
[/TR]
[TR]
[TD]Price[/TD]
[TD]DJFHA[/TD]
[/TR]
[TR]
[TD]Delivered[/TD]
[TD]11111111[/TD]
[/TR]
</tbody>[/TABLE]
and the result should come as below,
[TABLE="width: 790"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Model[/TD]
[TD]City[/TD]
[TD]Place[/TD]
[TD]KM[/TD]
[TD]Condition[/TD]
[TD]1st Owner[/TD]
[TD]2nd Owner[/TD]
[TD]3rd Owner[/TD]
[TD]Price[/TD]
[TD]Delivered[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]DEF[/TD]
[TD]GHI[/TD]
[TD]JKL[/TD]
[TD="align: right"]20[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD]PQR[/TD]
[TD][/TD]
[TD]STU[/TD]
[TD="align: right"]11111111[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]DJFHA[/TD]
[TD]SAHJA[/TD]
[TD]SHJ[/TD]
[TD="align: right"]5[/TD]
[TD]SAFH[/TD]
[TD][/TD]
[TD]SAHJA[/TD]
[TD]FGH[/TD]
[TD]DJFHA[/TD]
[TD="align: right"]11111111
[/TD]
[/TR]
</tbody>[/TABLE]
I wrote a code as,
Sub Macro3()
'
' Macro3 Macro
' extraction
'
' Keyboard Shortcut: Ctrl+i
'
Range("B1:B11").Select
Selection.Copy
ActiveSheet.Next.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
ActiveSheet.Previous.Select
Range("B13:B23").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Next.Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
It is taking only the particular range, but i have N number of data and it will get added more in future.
Can anyone help on this.
Thanks.
Last edited: