Compile Error:Expected Array

  • Thread starter Thread starter Fatima CN
  • Start date Start date
F

Fatima CN

Hi,
I am getting an error as (Compile Error:Expected Array) when i am
running the below macro.Pls help me to debug it


Sub copyVisible()
Dim copyFrom As Range
Set copyFrom = ThisWorkbook.Sheets("Analysis").Range("C5")
Do
Set copyFrom = copyFrom.Offset(1)
Loop Until copyFrom.EntireRow.Hidden = False
copyFrom.Copy
Sheets("PG_results").Select
Selection.PasteSpecial Paste:=xlPasteValues("PG_results").Range("B5")
Application.CutCopyMode = False
End Sub
 
You can skip the copy/paste and just assign the value directly
Sub copyVisible()
Dim copyFrom As Range
Set copyFrom = ThisWorkbook.Sheets("Analysis").Range("C5")
Do
Set copyFrom = copyFrom.Offset(1)
Loop Until copyFrom.EntireRow.Hidden = False

Sheets("PG_results").Range("B5").Value = copyFrom.Value


Tim
 
Back
Top