I am using some code I found on this site to transpose a section of a table
Copy Partial Table and Insert N-times, then Transpose second part of table
however I have found that it is not transposing the data beyond the last filled cell in the range being transposed, resulting in mis-alignments of the data in the resulting table. I believe it is due to the .End(xlUp) reference in the last line of the code.
tws.Cells(tws.Rows.Count, dataClmStrt + 2).End(xlUp).Offset(1).Resize(38, 1).Value = _
Application.Transpose(rng.Offset(, dataClmStrt).Resize(, 38))
Is this the cause of the issue and if so can this term be replaced with a set value?
EDIT---------------------------------------------------
To add some more information I have a table with 4 reference columns and 38 data column
Columns A-D contain identifiers to make each line item unique, columns 1-38 contain data in accordance to the heading category of the column.
A B C D | 1 2 3 ... 38
Not all of the 38 category columns contain data, some are empty cells
I am using the code from the reference link verbatim, except have changed to 12s to 38s to reflect the number of columns and expanded the main Arr to 38.
The code will copy the data down the rows correctly, and add the main Arr IDs correctly, but doesn't transpose the 38 columns of data correctly.
Once it reaches a cell with data, it will add this data to the tws sheet, the return to data column 1 and begin again, but in the next row. (i.e. if it finds data in column 12 in row 1 of the original table, it will add that data to row 12 of the new table, but the start adding data from column 1 row 2 of the original table to row 13 of the new table)
I have found by adding a checksum column (column 39) it will transpose correctly. Once the code has run, I use two other subs to remove the blanks and the check sums.
I would like to be able to run the code without needing the check sum column, or if possible eliminate the blanks automatically without additional subs.
Hope this is clearer