+ Reply to Thread
Results 1 to 7 of 7

For...next and thisworkbook.sheets error

  1. #1
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    118

    For...next and thisworkbook.sheets error

    Hello i have a bit of complex code(at least fo me), what it does is, the user click on a button and then choose a file to open, with the opened file it looks for a number defined in the original workbook (sheets("dados")). Then copy that number and past it on the original workbook and the repeat this work for each value in cells b3:b23 on the sheet "dados".

    Comments and msgbox are in portuguese.


    Please Login or Register  to view this content.
    The text as red is giving me a constant error. "application-defined or object-defined error"

    can you guys help me?

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,500

    Re: For...next and thisworkbook.sheets error

    Change the word Range to Cells in that line.
    Rory
    I drink, and I know things

  3. #3
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    118

    Re: For...next and thisworkbook.sheets error

    ty, that worked for that part but now i got stuck in
    Please Login or Register  to view this content.
    With the error "method 'Range' of object '_global' failed

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,500

    Re: For...next and thisworkbook.sheets error

    It's the same error. The syntax for Cells is Cells(row, column) but you can't use that with Range which needs either range objects or addresses like "A1".

  5. #5
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    118

    Re: For...next and thisworkbook.sheets error

    oh i see, i got it now :D

    Im really sorry but one last thing,

    i need it to loop through row 3 to row 23
    Please Login or Register  to view this content.
    .

    Do i need to something else or you thing that good the way it is?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,500

    Re: For...next and thisworkbook.sheets error

    That's fine the way it is.

  7. #7
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    118

    Re: For...next and thisworkbook.sheets error

    thank you :D

+ 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] Selectiong MULTIPLE Sheets in 'ThisWorkbook' using "With Sheets" Command
    By Ourkid123uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-14-2018, 09:44 AM
  2. [SOLVED] Color Index Error-ThisWorkBook
    By waqar1239 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2017, 02:27 AM
  3. [SOLVED] Removing Code from ThisWorkbook and error msg
    By karacooks in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2016, 04:21 PM
  4. [SOLVED] ThisWorkbook code not hiding named sheets
    By neelie777 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2014, 06:11 PM
  5. [SOLVED] Uncheck Checkbox on ThisWorkbook > On All Sheets
    By cychua in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-23-2013, 11:49 AM
  6. ThisWorkBook.Path Generates an Error
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2011, 10:41 AM
  7. Error on ThisWorkbook.Close method
    By Matt W in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-24-2011, 08:35 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