Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compile Error:Expected Array

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





*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Compile Error:Expected Array

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

End Sub



Tim


"Fatima CN" wrote in message
...
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





*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compile Error:Expected Array


Try changing:

Sheets("PG_results").Select
Selection.PasteSpecial
Paste:=xlPasteValues("PG_results").Range("B5")
to:

Sheets("PG_results").Select
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues
or shorter and without selecting:

Sheets("PG_results").Range("B5").value=copyFrom.va lue

not tested - (in haste).


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=144129

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error: Expected Array BEEJAY Excel Programming 7 December 8th 08 08:23 PM
compile error - expected an array John Excel Programming 8 September 21st 06 08:04 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
compile error: Expected: = ...Why? cesw[_2_] Excel Programming 3 September 10th 05 12:41 AM
Compile Error: Expected End Property George J[_3_] Excel Programming 4 August 3rd 05 03:35 PM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"