i have a problem with copy Data from a Range into another Sheet. In the Copy Range are some hidden Columms and filtered rows. With my Code ist only copy the visible Coluumms and rows into the nother sheet but i should copy all Data from the Range into the other sheet.
My Code that copy only the visible Data is
Worksheets("ANSICHT Komponente").Range("ANSICHT_Komponenten_Kostenanteil").Copy
'Einfügen auf dem Temp Daten Blatt
Worksheets("Temp_Daten").Range("B5:R56").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Hope u can help me that it will Copy all Data in the Range.
Thx Trekschaf
If you have a table with hidden rows/columns and you want to copy/pastespecial to another worksheet and to copy all the data, you must do it cell-by-cell. Say we have on Sheet1:
Running this:
Sub try_1_by_1()
Dim pets As Range
Set pets = Sheets("Sheet1").Range("A1:D20")
Dim r As Range
For Each r In pets
addy = r.Address
r.Copy
Sheets("Sheet2").Range(addy).PasteSpecial (xlValues)
Next r
End Sub
will transfer the entire range regardless of the filtering.
The loop can be avoided if you use a direct transfer rather then Copy
Sub try_another()
Dim r1 As Range, r2 As Range
Set r2 = Sheets("Sheet2").Range("A1:D20")
Set r1 = Sheets("Sheet1").Range("A1:D20")
r2.Value = r1.Value
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.