Gerasimos.Zap
Gerasimos.Zap

Reputation: 159

Copy values from one sheet to another without including pictures

I have a working copy and paste scripts, but they copy and paste the pictures. I am fairly sure it does this because the pictures are linked to the cells to size and move. What I would like to do is still copy the cells (their values), but without the pictures that are linked to the cells. This also needs to work on Windows as well as OS X.

Copy Script

Dim Section As Long, NextRow As Long
Dim FATPMetiPath As String, FATPMetiFolderPath As String

Sheets("Results").Activate
Range("Results").Select
Selection.AutoFilter
Range("Results").ClearContents

For Section = 1 To 8 '32

    NextRow = Sheets("Results").Range("A" & Rows.Count).End(xlUp).Row + 1 'Next empty row

    Sheets("Function Test Procedure").Select

    Range("FTPSec" & Section).Columns("A:N").Copy _
        Destination:=Sheets("Results").Range("A" & NextRow)

Next Section

Paste Script

    Set rngCopy = wsFTP.Range("FTPResults1").SpecialCells(xlCellTypeVisible)
    Set rngCopyNotes = wsFTP.Range("FTPResults2").SpecialCells(xlCellTypeVisible)
    Set rngCopyFRResults = wsFTP.Range("FTPResults3").SpecialCells(xlCellTypeVisible)
    Set rngCopyFRResults2 = wsFTP.Range("FTPResults4").SpecialCells(xlCellTypeVisible)

    NextRow = wsFail.Range("Fail_Report_Table").Cells(1, 1).Row
    rngCopy.Copy wsFail.Range("A" & NextRow)
    rngCopyNotes.Copy wsFail.Range("H" & NextRow)
    rngCopyFRResults.Copy wsFail.Range("C" & NextRow)
    rngCopyFRResults2.Copy wsFail.Range("D" & NextRow)

Upvotes: 1

Views: 40

Answers (1)

Scott Holtzman
Scott Holtzman

Reputation: 27249

For Copy Script

Change Range("FTPSec" & Section).Columns("A:N").Copy _ Destination:=Sheets("Results").Range("A" & NextRow)

To:

Dim TotalRows As Long
TotalRows = Range("FTPSec" & Section).Rows.Count
Sheets("Results").Range("A" & NextRow).Resize(TotalRows,14).Value = Range("FTPSec" & Section).Columns("A:N").Value

For Paste Script

Write this (to replace the last 4 lines in your code):

wsFail.Range("A" & NextRow).Value = rngCopy.Value
wsFail.Range("H" & NextRow).Value = rngCopyNotes.Value
wsFail.Range("C" & NextRow).Value = rngCopyFRResults.Value
wsFail.Range("D" & NextRow).Value = rngCopyFRResults2.Value

Upvotes: 2

Related Questions