+ Reply to Thread
Results 1 to 8 of 8

Code no longer Working, Error 91

  1. #1
    Registered User
    Join Date
    02-12-2018
    Location
    Canada
    MS-Off Ver
    Pro 2010
    Posts
    4

    Code no longer Working, Error 91

    Hi,

    I have a spreadsheet that uses this code on one of the sheets. It's used for charting a row of variables based on what row you click on. It can also chart based on what row you select with the up and down arrows (spinbuttons). Basically I have a row of variables and I load that row into the chart. The row is selected via CR7. The variables in the row are loaded using the "=INDIRECT("X"&$CR7)". I don't know what changed but this used to work, now when I open the spread sheet I get Error 91. As far as I can tell it might be that chkRowClick_Click() is not being set to True but I can't tell where it gets set on the sheet. I didn't make this sheet or code so I'm hoping this is a simple fix if anyone can help?

    Thanks

    Please Login or Register  to view this content.
    Last edited by Barn01; 02-13-2018 at 09:14 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code no longer Working, Error 91

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-12-2018
    Location
    Canada
    MS-Off Ver
    Pro 2010
    Posts
    4

    Re: Code no longer Working, Error 91

    Quote Originally Posted by Norie View Post
    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    Here it is. I've only included the raw data 'sheet1' and the chart sheet that has the VBA issue

    Thanks for looking
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Code no longer Working, Error 91

    The attached file shows no error.

    I've looked into the code but found nothing that might cause Error 91.

  5. #5
    Registered User
    Join Date
    02-12-2018
    Location
    Canada
    MS-Off Ver
    Pro 2010
    Posts
    4

    Re: Code no longer Working, Error 91

    Quote Originally Posted by yujin View Post
    The attached file shows no error.

    I've looked into the code but found nothing that might cause Error 91.
    Well I'm confused then because the sheet doesn't work anymore. I can change rows and the chart doesn't get the corresponding row's values. Are you saying this part works for you?

    I just don't understand why the:

    =INDIRECT("J"&$CR7)
    =INDIRECT("AW"&$CR7)

    Line doesn't work? It used to work but now it doesn't update the value from row CR7. That is the Row that the chart uses for its input data.
    Last edited by Barn01; 02-13-2018 at 04:41 PM. Reason: Confused

  6. #6
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Code no longer Working, Error 91

    I guess the Automatic Calculation is turned off.
    How about adding "Me.Calculate" line to the code like below.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-12-2018
    Location
    Canada
    MS-Off Ver
    Pro 2010
    Posts
    4

    Re: Code no longer Working, Error 91

    Quote Originally Posted by yujin View Post
    I guess the Automatic Calculation is turned off.
    How about adding "Me.Calculate" line to the code like below.

    Please Login or Register  to view this content.
    It worked!

    Thank you so much. Now I wonder why it used to work if that code was never there?

    What does Me.Calculate do?

  8. #8
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Code no longer Working, Error 91

    Glad it worked.

    Now I wonder why it used to work if that code was never there?
    The Automatic Calculation is set to be "ON" by default but it can be accidentally turned off. By selecting Formulas ribbon and choose Calculation Options, you can change the setting.

    What does Me.Calculate do?
    "Me" is equivalent to "This Worksheet", so "Me.Calculate" recalculates the formulas of the sheet even if Auto Calculation is set to be "OFF".
    Last edited by yujin; 02-14-2018 at 12:22 AM.

+ 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. Code to hide rows is no longer working
    By NancyPez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2016, 11:36 AM
  2. PasteSpecial in VBA Code No Longer Working
    By kmsandrbs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2014, 01:27 PM
  3. VB Code no longer working
    By buttercup1227 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2014, 10:38 AM
  4. [SOLVED] Private sub code no longer working (print area macro)
    By rikkyshh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2013, 10:43 AM
  5. [SOLVED] Code stopped working, can no longer copy and save a worksheet
    By Oracle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2012, 07:56 PM
  6. VBA Code no longer working
    By jdbel in forum Excel General
    Replies: 16
    Last Post: 11-16-2011, 07:33 PM
  7. mail Code no longer working in 2007
    By lonnied in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2007, 06:14 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