VBA to select not hidden cells and copy to another workbook

Anyone knows how to create VBA code to select cells from this (IRL color doesn’t exist)

to this?

The nearest i can get is only these but the two highlighted lines doesn’t work for merged cells.

Here’s attached the test data.
Test Data.xlsx (16.0 KB)

Sheet1 is input
Sheet2 is expected output (should be in new workbook)