+ Reply to Thread
Results 1 to 3 of 3

Excel macro does not work when saving in Excel 1993-2003 format

Hybrid View

HMJ Excel macro does not work... 02-29-2012, 07:30 PM
royUK Re: Excel macro does not work... 03-01-2012, 03:19 AM
OnErrorGoto0 Re: Excel macro does not work... 03-01-2012, 03:58 AM
  1. #1
    Registered User
    Join Date
    02-26-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2007
    Posts
    1

    Excel macro does not work when saving in Excel 1993-2003 format

    Hello there,

    I have a problem with a macro that worked fine in Excel 2010, but does not work, when I saved the file in Excel 1997-2003 format.
    (I am running Excel 2010 on a VmWare Fusion virtual machine running Windows 7 on my MacBook Pro.)

    The structure of the macro is as follows (some lines in between deleted). The purpose of the macro is to display certain rows of the sheet when a cell (F105) has a certain value and hide the rest of the rows.

    Private Sub CommandButton1_Click()
    Select Case Range("F105").Value
    Case 1
      Rows("111:212").Hidden = False
      Rows("214:3714").Hidden = True
    Case 2
      Rows("111:212").Hidden = True
      Rows("214:315").Hidden = False
      Rows("317:3714").Hidden = True
    ...
    Case 37
      Rows("111:3303").Hidden = False
    End Select
    End Sub
    When saving the workbook in 1993-2003 format, I get "Runtime error '13': Type mismatch". Before this, the macro worked fine.


    Any ideas how to solve this issue?


    Many thanks!
    Last edited by davesexcel; 02-29-2012 at 09:14 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel macro does not work when saving in Excel 1993-2003 format

    Are you sure that the error is in this code & not the lines that you have removed? Try using EntireRow

    Private Sub CommandButton1_Click()
        Select Case Range("F105").Value
        Case 1
            Rows("111:212").EntireRow.Hidden = False
            Rows("214:3714").EntireRow.Hidden = True
        Case 2
            Rows("111:212").EntireRow.Hidden = True
            Rows("214:315").EntireRow.Hidden = False
            Rows("317:3714").EntireRow.Hidden = True
            ...
        Case 37
            Rows("111:3303").EntireRow.Hidden = False
        End Select
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Excel macro does not work when saving in Excel 1993-2003 format

    Also, what is the value in F105?
    Good luck.

+ 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