+ Reply to Thread
Results 1 to 4 of 4

Macro failed in transfer to VB code

  1. #1
    Registered User
    Join Date
    06-23-2011
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    Macro failed in transfer to VB code

    I created a macro to move value-only information from another workbook, then created a command button and attached the code. The macro runs and works, but when the button is pressed I get an error 1004 Select method of range class failed. The debug stopped on the fourth line of the code:

    Range("A15").Select
    Windows("GWS Extractor (V8).xls").Activate
    Sheets("Raw Data Transfer").Select
    Range("A16:BW10015").Select
    Selection.Copy
    Windows("GWS Analyzer.xls").Activate
    Sheets("Database Transfer").Select
    Range("A16").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Any clues to the problem? Both workbooks are open. The full code has multiple rehashes of the same basic code, pulling from different locations and placing in different locations.

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro failed in transfer to VB code

    You can shorten that code to simply:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-23-2011
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro failed in transfer to VB code

    Whizbang,

    Yeah, Im sure the macro recorder code is pretty clumsy, since it only knows what each keystroke wants to do, not what the full intent is. I will make the sub and give this a try.

    Thanks

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro failed in transfer to VB code

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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