Macro to copy from one worksheet and paste only into visible cells from another

1

I need to copy the "L" column of the "DIVISION" worksheet to the filtered cells of the "L" column of the "DPTO" worksheet. That is, I need a macro that searches the information in a worksheet and pasts only the visible cells of the other.

I was able to make two macros: the first search information from another "DIVISION" worksheet and paste it into the "DEPT" worksheet. Until then, okay. Only I need to paste this information only into the visible cells (filter), and this macro pastes into the hidden cells as well. The 2nd macro copies and sticks to the visible cells, except that the tables must be on the same worksheet. I was unable to leave the tables in separate worksheets and run the macro.

What I need is: fetch data from one worksheet and paste it only into the visible (FILTERED) cells of the other worksheet.

I tried to merge the two, through CALL, but when I went to run it gave an error message saying that it is incompatible.

Below are the macros:

Sub COPIARPLANILHA()
'
' COPIARPLANILHA Macro
'

Sheets("DIVISÃO").Select
Range("L7:L714").Select
Range("L7:L714").Select
Selection.Copy
Sheets("DPTO").Select
Range("L7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("G1").Select
End Sub


Sub Copiar_Celulas_Visiveis()
Set too = Application.InputBox("Selecione o intervalo de células de destino", Type:=8)
For Each Cell In from
Cell.Copy
For Each thing In too
If thing.EntireRow.RowHeight > 0 Then
thing.PasteSpecial
Set too = thing.Offset(1).Resize(too.Rows.Count)
Exit For
End If
Next
Next
End Sub
    
asked by anonymous 09.07.2015 / 15:32

1 answer

2
When you save the macro, copy and when you paste select from L7 to L (number you want) then hold ALT + ; (Alt + comma) This command allows you to select only filtered data, ignoring the hidden data.

    
16.03.2016 / 18:17