+ Reply to Thread
Results 1 to 5 of 5

Worksheet_change error

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Worksheet_change error

    Hi,

    I'm having a little trouble finding what's wrong with my code. The code is used in this situation: in sheet "Pavedimai" user has to enter security's code. Then the project tries to find this code in sheet "Isin". If project finds security code in sheet "Isin", then it copies security's name from sheet "Isin" to sheet "Pavedimai". If project can't find security's name in sheet "Isin", then it posts message box.

    Everything goes perfect in sheet "Pavedimai", but I have a lot of trouble trying to search VP code in sheet "Isin". The first problem was trying to force project to select range "A1" in sheet "Isin" because code
    Please Login or Register  to view this content.
    didn't work due to some reason. I overcame this issue by using code
    Please Login or Register  to view this content.
    instead.

    The second problem is in line marked with the stars
    Please Login or Register  to view this content.
    .
    Due to some reason code
    Please Login or Register  to view this content.
    remembers cell value in sheet "Pavedimai" although at this moment sheet "Isin" is selected. And I can't understand why this code is unable to select particular range in sheet "Isin" and remember that range value.

    Does anyone of you have any ideas what's wrong with this code?

    Please Login or Register  to view this content.
    Last edited by walduxas; 04-12-2012 at 04:54 AM.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Worksheet_change error

    Try this

    Insted of This code

    Please Login or Register  to view this content.
    Use this code

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Worksheet_change error

    I've tried that already in this case I get error message "Run-time error '450': wrong number of arguments or invalid property assignment".

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Worksheet_change error

    Due to Err.Number <>0 the following code may be selecting "Pavedimai" Sheet.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Worksheet_change error

    That's not the case. I tested my code using watch window and running it step by step. That error handling code does not open sheet "Pavedimai".

    However, I think I found a solution to all my problems. I replaced code
    Please Login or Register  to view this content.
    with code

    Please Login or Register  to view this content.
    In modules section I inserted new module and created new function:

    Please Login or Register  to view this content.
    In this case no errors occur and the code runs very smoothly
    Anyway, thank's for your help

+ 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