Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object Required - Excel VBA

Posted on 2013-06-24
2
Medium Priority
?
585 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
[X]
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
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

661 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