+ Reply to Thread
Results 1 to 6 of 6

Novice errors while copying cells - advice required

  1. #1
    Registered User
    Join Date
    06-16-2018
    Location
    Russian Federation
    MS-Off Ver
    2016
    Posts
    2

    Novice errors while copying cells - advice required

    Hello, everyone
    I am completely new in macros/programming/VBA, but recently I have started to work on a project, which requires to write a macros to do the following:
    1. From the active workbook choose the target workbook
    2. Copy sheet from target workbook (without opening it) to active workbook as sheet2
    3. Copy some values from sheet2 to sheet1 and perform some mathematical operations on them at the same time

    Here is a piece of code i wrote:
    Please Login or Register  to view this content.
    So the problem I am facing is that I can copy values using copy/paste commands, but this is not what I really want.
    I'd like to copy values either using variables or assignment like this:
    Please Login or Register  to view this content.
    But both options return me an error of 438:
    Object doesn't support this property or method.
    I am kindly asking to have a look a provide a piece of advice what I am doing wrong.
    Thanks a lot in advance!

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Novice errors while copying cells - advice required

    Hi,
    Welcome to the forum.

    Shouldn't it be FDCreator.Sheets("Sheet1").Range("A1") = FDCreator.Sheets("Sheet2").Range("G19")?
    Or you are trying to use the sheet code names instead?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Novice errors while copying cells - advice required

    Please Login or Register  to view this content.
    Referencing a sheet like this is using the sheet's code name.

    You can only reference code names for the sheets in the same workbook that contains the macro code. You cannot use sheet code names for external workbooks. Also, you wouldn't use a workbook qualifier when using a sheet code name because it only applies to the workbook that contains the macro code.

    Try this. It uses sheet index numbers instead of code names.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 06-16-2018 at 11:58 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Novice errors while copying cells - advice required

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-16-2018
    Location
    Russian Federation
    MS-Off Ver
    2016
    Posts
    2

    Re: Novice errors while copying cells - advice required

    Thank all of your for your replies!
    I have changed my code as per the recommendations and it works now!

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Novice errors while copying cells - advice required

    You're welcome!

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

    You may also say thanks to those who have put their time and efforts to help you in this forum by clicking the Add Reputation link under their posts, another way to say thanks.

+ 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. [SOLVED] Advice on copying cells into second tab
    By motorhomer in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-02-2018, 08:03 AM
  2. Help required from a relative novice and newby
    By TRIWAY in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 02:21 PM
  3. Help required from a relative novice and newby
    By TRIWAY in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 12:30 PM
  4. Help required from a relative novice and newby
    By TRIWAY in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 12:24 PM
  5. [SOLVED] Macro to make copying cells automate,- an appeal for expert's advice!
    By Arty_1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-04-2014, 07:22 AM
  6. [SOLVED] Userform Code Errors (broken by novice/fool)
    By D.A.S in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-25-2013, 10:11 PM
  7. [SOLVED] Need advice on how to automate copying one cell into many cells in Excel 2010
    By shelbyjayIII in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2013, 05:48 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