VBA required for Transposing COL to ROW

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
243
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Not sure how to describe it, but I need the data to auto transpose to another Workbook as it is tedious and time consuming to enter it manually from Columns to rows.
The explanations are below each table. Please feel free to ask if you are not clear.

- Each row must be transferred and transposed to "SAMPLOID.XLSX" Workbook
- Columns G-M must each have it's own row. Columns can vary. Sometimes there are more data and can go from G-Z. Sometimes there are less columns, example from G-I only.

SAMPLE Original.xlsx | SHEET1
ABCDEFGHIJKLM
SHEET2!B1SHEET2!B2
Sheet2!B4
G3-T-I-2G3-T-I-3G3-T-I-4G3-T-I-5G3-T-I-6G3-T-I-7G3-T-I-8
VIA RAILAMTRAKSHINKASENDUO RAILT TRAKBARTMTR
AAABBBCCCDDDEEEFFFEnter QTYEnter QTYEnter QTYEnter QTYEnter QTYEnter QTYEnter QTY
1110010VICTORIAWESTVC774531235
2110011MELBOURNESOUTHMB346541
3110014NEW YORKEASTNY636341244
4110015MIAMISOUTHMM42745466
5110016BOSTONEASTBS346891222222
SHEET1



SAMPLE Original.xlsx | SHEET2
PASSENGER #Sheet1$C$1TRIP SUMMARY
PASSENGER NAMESheet1$D$1
SECTIONCoach
CHARGE CARDSheet1$C$2
G-CODETRAILQTY PRICE TOTAL
G3-T-I-2VIA RAIL0$100.00$0.00
G3-T-I-3AMTRAK0$101.00$0.00
G3-T-I-4SHINKASEN0$102.00$0.00
G3-T-I-5DUO RAIL0$103.00$0.00
G3-T-I-6T TRAK0$104.00$0.00
G3-T-I-7BART0$105.00$0.00
G3-T-I-8MTR0$106.00$0.00
SHEET2


SAMPLOID.xlsx
Please take note of the Column Heading Lettering as it is relevant. I hid some columns that were not relevant this.
- Each row is transferred and transposed from "SAMPLE ORIGINAL.XLSX" Workbook.
- Columns G-M must each have it's own row. Columns can vary. As soon as the SAMPLE ORIGINAL.XLSX SHEET2! BBB (corresponds to CCC) changes, then a blank row must be inserted before the next BBB begins.
- Take note that Column B (AAA) numbering is restarted for each new section.
- Price Lookup is from SAMPLE ORIGINAL.XLSX SHEET2! , based on the G-Code.
Want an easy-to-modify VBA script so it can be easily modified for a different setup, if so required. Remember I'm a noob.
Hopefully I have explained this as clearly as possible. I really appreciate your help. Thanking you in advance.

BCDEQRVW
AAABBBCCCDDDG-Code #*TRAIL*QTY*Price* From Samploid|Sheet2
1110010VictoriaWESTG3-T-I-2VIA RAIL1$ 100.00
2110010VictoriaWESTG3-T-I-3AMTRAK2$ 101.00
3110010VictoriaWESTG3-T-I-4SHINKASEN3$ 102.00
4110010VictoriaWESTG3-T-I-8MTR5$ 106.00
1110011MELBOURNESOUTHG3-T-I-2VIA RAIL2$ 100.00
1110014NEW YORKEASTG3-T-I-2VIA RAIL2$ 100.00
2110014NEW YORKEASTG3-T-I-4SHINKASEN2$ 102.00
3110014NEW YORKEASTG3-T-I-7BART4$ 105.00
4110014NEW YORKEASTG3-T-I-8MTR4$ 106.00
1110015MIAMISOUTHG3-T-I-6T TRAK2$ 104.00
2110015MIAMISOUTHG3-T-I-7BART6$ 105.00
3110015MIAMISOUTHG3-T-I-8MTR8$ 106.00
1110016BOSTONEASTG3-T-I-2VIA RAIL2$ 100.00
2110016BOSTONEASTG3-T-I-3AMTRAK2$ 101.00
3110016BOSTONEASTG3-T-I-4SHINKASEN2$ 102.00
4110016BOSTONEASTG3-T-I-5DUO RAIL2$ 103.00
5110016BOSTONEASTG3-T-I-6T TRAK4$ 104.00
6110016BOSTONEASTG3-T-I-7BART6$ 105.00
7110016BOSTONEASTG3-T-I-8MTR6$ 106.00
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
How do I modify this script to accomodate this post?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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