Hope you all are doing good. I am working on a workbook in which i have a column of 10 consecutive cells.
On another sheet there is a row where i want to paste that data as transposed but the problem is, some cells in that rows are not consecutive some of them are hidden. like in image:
Now i want to paste Data to visible cells only as Transpose and those cells must be paste as a link as if any changes made to first sheet, the relative cell in second sheet should also be change. Luckily i have done much working by my self as i found how to paste to visible cells only by following VBA code:
Sub PasteToVisible()
'Declarations
Dim Range1 As Range
Dim Range2 As Range
Dim InputRange As Range
Dim OutputRange As Range
'Prompt Box Title
xTitleId = "Paste to Visible"
'Start Input Range
Set InputRange = Application.Selection
'Select input range box
Set InputRange = Application.InputBox("Copy Range :", xTitleId, InputRange.Address, Type:=8)
'Select output range box
Set OutputRange = Application.InputBox("Paste Range:", xTitleId, Type:=8)
'Loop to paste the range in visible cells
For Each Range1 In InputRange
Range1.Copy
For Each Range2 In OutputRange
If Range2.EntireRow.RowHeight > 0 Then
Range2.PasteSpecial
Set OutputRange = Range2.Offset(1).Resize(OutputRange.Rows.Count)
Exit For
End If
Next
Next
Application.CutCopyMode = False
End Sub'
This can Paste values to visible cells but in columns only (Not Transpose). For Transpose and Link, I am using a simple excel formula of Transpose as in Image below:
This can link the values in Transposed form. I want to combine all three functions (Paste to visible, Transpose and As a link) in one Step. Please Help me on this. I will really appreciate any suggestion and Help. Thanks in advance.