I've an excel sheet which basically will have a variable numbers in Columns A till C, it gets filtered to unique values based on for next
loop I've achieved this and next I'm trying to copy the visible range starting from column F till last column
(since variable columns each time when filters) and transpose it vertically in new sheet.The approach that I've used is counting each visible row and copy till end. Here's the code.
Set ws = ActiveSheet
Set WS2 = ThisWorkbook.Sheets("3")
L2 = ws.Cells(Rows.Count, 1).End(xlUp).Row
For Each CELL In ws.Range("F2:F" & L2).SpecialCells(xlCellTypeVisible)
i = CELL.Row
L3 = ws.Cells(i, Columns.Count).End(xlToLeft).Column
ws.Range(Cells(i, 6), Cells(i, L3)).Copy
L4 = WS2.Cells(Rows.Count, 4).End(xlUp).Row
WS2.Cells(L4 + 1, 4).PasteSpecial Paste:=xlPasteAll, Transpose:=True
Next CELL
But is there any alternate way to copy and transpose cells that have values from Column F till last column?In the above example starting from F108:H110
select and copy only cells that have values in it.