Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Object Required - Excel VBA

Posted on 2013-06-24
2
547 Views
Last Modified: 2013-06-24
Hi

When I try to ask the attached code, it ask for object required.  Can someone explain why, and how to fix it.

Sub Test2()
Dim NewDestination As Long
Range("A:D").SpecialCells(xlCellTypeConstants, xlNumbers).Copy Range("I1")
Set NewDestination = Range("I1")
For Each Rng In Cells.SpecialCells(xlCellTypeConstants, xlNumbers).Areas
    Rng.Copy Destination:=NewDestinations
    Set NewDestination = NewDesttination.Offset(Rng.Rows.Count)
Next Rng
End Sub

Thanks

Greg
0
Comment
Question by:greg_c
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39273477
Change Set NewDestination = Range("I1") to NewDestination = Range("I1").
The set keyword is for objects.
0
 

Author Closing Comment

by:greg_c
ID: 39273491
Thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question