How do i change the first table to second table?

Status
Not open for further replies.

excelvbabeginner

New Member
Joined
Nov 25, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
This is the table i have.

NameCodeNameCodeNameCode
AA1BB1CC1
DD1EE1FF1
GG1HH1II1

This is the table i want.
NameCode
AA1
BB1
CC1
DD1
EE1
FF1
GG1
HH1
II1

I want to change the first table to second table. How can I do it? Any help with the formula or VBA would be a great help. Thank you!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi
As a beginner
Try this code
VBA Code:
Sub test2()
Dim a As Variant
Dim b As Variant
Dim i As Long: Dim ii As Long
a = Cells(1).CurrentRegion
ReDim b(1 To ((UBound(a) - 1) * UBound(a, 2) / 2), 1 To 2)
For i = 2 To UBound(a)
        For ii = 1 To UBound(a, 2) Step 2
            b(k + 1, 1) = a(i, ii): b(k + 1, 2) = a(i, ii + 1)
            k = k + 1
        Next
Next
Cells(8, 1).Resize(, 2) = a
Cells(9, 1).Resize(UBound(b), UBound(b, 2)) = b
End Sub
 
Last edited:
Upvote 0
Solution
Duplicate to: How to convert the first table to second table?

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,567
Messages
6,120,268
Members
448,953
Latest member
Dutchie_1

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