+ Reply to Thread
Results 1 to 8 of 8

VBA 2003 vs 2007

  1. #1
    Registered User
    Join Date
    08-25-2008
    Location
    Iceland
    Posts
    19

    VBA 2003 vs 2007

    Hi

    Is there any changes in VBA codes between 2003 and 2007

    I have a problem whit this code.
    It works in Excel 2003 but not in Excel 2007

    Private Sub CommandButton2_Click()

    ActiveSheet.Outline.ShowLevels RowLevels:=1

    startline = Range("B1").Value 'startline is defined numers of rows in a colum
    endline = Range("c1").Value 'endline is defined numers of rows in a colum

    For i = startline To endline
    If Range("CC" & i).Value <> 0 Then
    Range("b" & i).Activate
    Selection.EntireRow.Hidden = False
    End If
    End Sub

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    As a first step, see Roy's answer here:
    http://www.excelforum.com/excel-prog...c-changes.html

  3. #3
    Registered User
    Join Date
    08-25-2008
    Location
    Iceland
    Posts
    19
    I have more comandbutton in that sheet that works.
    I think this problem has something to do with "showlevels rowlevels".
    As you can se, I'm trying to hide rows with values 0 in colum "cc".
    Any suggestion?

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Do you get an error with the code you have?

  5. #5
    Registered User
    Join Date
    08-25-2008
    Location
    Iceland
    Posts
    19
    No, there is no error, it runs but is doesn't hide the rows.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    The code works for me. Is this button on the sheet you want to hide rows for? Also, do you actually have grouping applies to this sheet, becuase if you don't then the code will do nothing.

  7. #7
    Registered User
    Join Date
    08-25-2008
    Location
    Iceland
    Posts
    19
    This button is on the sheet.
    I found a solution, I just had to hide all the rows first and then run the code, unhide rows with value <> 0.

    Thanx

  8. #8
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387
    Quote Originally Posted by Doolafs View Post
    This button is on the sheet.
    I found a solution, I just had to hide all the rows first and then run the code, unhide rows with value <> 0.

    Thanx

    If you don't want to have to hide all the rows first, then change the code to this:

    Please Login or Register  to view this content.

+ 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. Excel 2007 : Macro 2003 crashes in 2007
    By Fun4You in forum Excel General
    Replies: 0
    Last Post: 06-09-2008, 09:53 AM
  2. Replies: 1
    Last Post: 03-12-2008, 09:14 AM
  3. Drawing conflict between 2003 & 2007
    By chris druma in forum Excel General
    Replies: 0
    Last Post: 02-04-2008, 07:06 AM
  4. NETWORKDAYS in 2003 and 2007
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2007, 05:21 PM
  5. Excel 2003 or 2007?
    By Novice_704 in forum Excel General
    Replies: 5
    Last Post: 10-05-2007, 03:07 AM

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