+ Reply to Thread
Results 1 to 2 of 2

Problem with copying data to a new sheet with a name as variable

  1. #1
    Registered User
    Join Date
    11-05-2020
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    1

    Problem with copying data to a new sheet with a name as variable

    Hello Everyone,

    i have a problem in my macro. I am just a beginner in VBA, so sorry if this problem is really easy. I have an external Access database. I programmed, that this database will be export to the worksheet "data_today". And what i want to do now, is to copy this data to a new worksheet with a today date. It should happen everyday. This is the part of the code, where is my error:

    Please Login or Register  to view this content.
    This code create the new sheet, copy the data from the old sheet, but it doesn't paste the data into the new sheet. Can someone help?

    Greetings,
    Aga

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Problem with copying data to a new sheet with a name as variable

    Your syntax is incorrect. Destination is an optional argument label so if you use it, it has to look like this
    Please Login or Register  to view this content.
    You are trying to use Destination as a variable. If you used Option Explicit then you would have seen your error right away. I strongly recommend to everyone that they declare variables. Doing so prevents a lot of bugs and runtime errors.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 06-30-2020, 04:28 AM
  2. Macro Code problem when Copying Selected (variable) cells with filters
    By sx200n in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2015, 06:55 AM
  3. Facing problem in excel while copying data from one sheet to another sheet
    By krasathi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-03-2012, 04:40 AM
  4. Copying a sheet in VBA using a variable string
    By deucejmp in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-17-2011, 06:39 PM
  5. Copying data from one sheet to another based on variable date range
    By Colin1226 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2010, 02:38 AM
  6. Replies: 2
    Last Post: 06-09-2010, 09:15 AM
  7. Copying from variable named sheet...
    By shikamikamoomoo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2006, 09:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1