+ Reply to Thread
Results 1 to 5 of 5

Run Time Error '1004': Select method of Range Class failed VBA

  1. #1
    Registered User
    Join Date
    04-16-2014
    Location
    Lima, Peru
    MS-Off Ver
    Excel 2010
    Posts
    4

    Run Time Error '1004': Select method of Range Class failed VBA

    Hi everyone! I'm new in this community and I'm very glad to form part of it. First of all, I consider I am an intermediate user of VBA so I have a certain level of skill working with it. However, I am in trouble with this work I have to do because I don't get to accomplish my goal of running it.

    First I will explain what my purpose is about.

    I have a lot of workbooks, each with a code as a name, for example, one workbook is "2014T1AH54". where "2014" is the year "T1" is the first trimester (this could be T2 T3 or T4), "AH" is something that is not going to change and "54" represents a number which will vary from 1 to 180.

    This workbooks have only one sheet (sheet 1) and each one contains information in tables which I have to extract of and place it in my workbook called "registro".

    I have already achieved to extract the information from one workbook. However I get trouble when I have to extract of all these workbooks at the same time. The point is that the information in the table of each workbook must be placed if the table of my workbook "registro" is empty. In other words, I have to paste the content of the table going down. For example, once I copied the information of the table of 2014T1AH54 in the workbook registro table, then the next line of it will serve as the first place to enter the other table information of the workbook called 2014T2AH54, then going down I will copy the information of 2014T3AH54 and so on. I have my code here and this is:

    Please Login or Register  to view this content.
    What is highlighted with red color is the one that doesn't work. It doesn't work with select or activate and I don't know why. I don't get to run the program because I can't activate the range and proceed to find if activecell.offset(0,2) is empty. Because if this cell is full, then this means there is the information of the last workbook copied (for example: the information of 2014T2AH54). I can't copy if this cell or range is fulled, because, as well as I said, I want to copy all the information going down without loosing any info.

    I hope I could be explicit in my purpose and hope answers please,

    just in case, I have an example attached of for example, also I have the workbook called "datos2" where the code is located and I have the workbook called "2014T2AH54" where which I have to extract this information!

    thank you very much in advance,

    Jos
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by jcgonzales; 04-17-2014 at 02:27 PM. Reason: title error and I didn't put well the code

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: my code doesn't work

    Hi Jos and welcome to the forum.

    Your line of:
    ThisWorkbook.Sheets(1).Range ("a5")
    might need to be
    ThisWorkbook.Sheets(1).Range ("a5").Select
    instead.

    It is much easier for us to help if you attach an Excel Workbook. You can do that by going to the "Go Advanced" and then clicking on the Paper Clip Icon above the advanced message box.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: my code doesn't work

    Or

    move this line with continuation of the previous line of code (nearby the copy)

    ThisWorkbook.Sheets(1).Range ("a5")


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: my code doesn't work

    Welcome to the forum.

    We'd like to help you but first..

    Pls take some minutes to read forum rules and specially-in this case- rule#3 and add code tags around your code.

    Also

    Pls take some minutes to read forum rules and specially-in this case- rule#1 and amend your title

    Then anyone will be able to help you.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Registered User
    Join Date
    04-16-2014
    Location
    Lima, Peru
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Run Time Error '1004': Select method of Range Class failed VBA

    I have already fix the mistakes. However my post is not in the principal page of the this forum section! how could I get noticed of people for help? please I need answers!

    thank you

+ 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] Code in Worksheet_Change doesn't work
    By Rufles in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-25-2014, 06:09 AM
  2. [SOLVED] New Code Copy Doesn't Work properly
    By Kyle123 in forum Suggestions for Improvement
    Replies: 3
    Last Post: 07-18-2012, 08:00 AM
  3. code from Excel Help doesn't work
    By ryan darrow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2011, 01:17 PM
  4. [SOLVED] Why doesn't ths VBA Code work?
    By Mac Lingo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-23-2005, 10:10 PM
  5. vba code doesn't work
    By lschuh in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 07-22-2005, 02:05 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