Compile Error:Expected Array

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
 
T

Tim Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top