+ Reply to Thread
Results 1 to 6 of 6

Sherlock, Can You Find Cause of Macro Error on FileOpen

  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    Silver Bay, MN
    MS-Off Ver
    Excel 2010
    Posts
    47

    Sherlock, Can You Find Cause of Macro Error on FileOpen

    SHERLOCK WORTHY PROBLEM: Is there a Sherlock that can solve this problem. When workbook is opened an error box pops up noting that it is "unable to get the Hidden property of the range class" pertaining to a line in the code. The mystery is rooted in an unexplained diversion of code in the Workbook_Open module which is tracked through the code below. Why is code diverted? How to remedy? File is attached. Also, see background information.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    BACGROUND: This is a budget summary workbook with three sheets. Sheet 1 shows Budget income & expenses. Sheet 2 shows Actual income & expenses. Sheet 3 shows the NetDiff of sheets 1 & 2. Each sheet is identical in programs represented and accounts structure. (Programs may change but accounts do not.) Filtering criteria of accounts with data is applied via formulas in Col B. Data can be filtered with the AutoFilter arrow in Col B. (To facilitate debugging, a filter toggle button on each sheet has been hidden and associated code disabled until the problem discussed in this query is resolved.)

    VBA code facilitates data entry. To enter data, select Budget or Actual tab. (Data can be reviewed but not entered into the NetDiff sheet.) Using the comboboxes on the sheet, select a program. Then select an accounts catagory. There is a Show All and Print button on each sheet. The sheets are protected.

    A notable feature of this workbook is that actions on one sheet are reflected on the other two sheets. For example, if program X is selected on any sheet (thereby hiding other programs), that action is replicated on the other two sheets. Same with selection of account catagories, filtering data and restoring data to default (fully revealed) state.

    Note: Tasks remaining include reinstating hidden filter toggle buttons and associated code, fixing incorrect formulas in NetDiff sheet and final debugging and testing including print macros.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Sherlock, Can You Find Cause of Macro Error on FileOpen

    don't use Sheet1, Sheet2 ... , use always Sheets("name") to avoid confusion
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Sherlock, Can You Find Cause of Macro Error on FileOpen

    In normal module add:
    Please Login or Register  to view this content.
    In module for NetDiff sheet change code to:
    Please Login or Register  to view this content.
    In ThisWorkbook module:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-02-2012
    Location
    Silver Bay, MN
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Sherlock, Can You Find Cause of Macro Error on FileOpen

    Izandol, you receive the SHERLOCK AWARD!! Your code solved the mystery that has puzzled me for too many hours. Thank you!!

  5. #5
    Registered User
    Join Date
    12-02-2012
    Location
    Silver Bay, MN
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Sherlock, Can You Find Cause of Macro Error on FileOpen

    Izandol, I would like to know why your code works. How did you know to define & use variable "Public bNoEvents As Boolean" in the code?

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Sherlock, Can You Find Cause of Macro Error on FileOpen

    Application.Enableevents does not affect controls - on worksheets or userforms - so we must create our own version. If you do not link the controls to cells you may also avoid the problem.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

+ 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. Change code to start without fileopen and directly with F11
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2012, 04:49 PM
  2. Fileopen Logic
    By Baapi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2007, 08:51 AM
  3. [SOLVED] api fileopen dialog - lpstrFile size limitation?
    By Mike Weaver in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2005, 06:20 PM
  4. Run-Time error 13 on a FileOpen command
    By Willibrord Koot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2005, 03:12 AM
  5. [SOLVED] vba excel fileopen
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-16-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