+ Reply to Thread
Results 1 to 6 of 6

Add/Hide lines in invoice or qoute

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Add/Hide lines in invoice or qoute

    Good day,
    Maybe someone can help me? I have made a simple invoice/quote system in excell, with a max of 15 items. Now I want to know if it is possible to hide the lines not used in the excell sheet?

    I have attached the excell file for an example

    Thank you very much

    Jakes
    Attached Files Attached Files
    Last edited by Jakes; 03-22-2011 at 05:09 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: Add/Hide lines in invoice or qoute

    Maybe like this
    Sub Rectangle7_Click()
        Dim rCl As Range
        Select Case MsgBox("Do you want to hide unused rows?", vbYesNo Or vbExclamation Or vbDefaultButton1, "Empty Rows")
    
        Case vbYes
            For Each rCl In Range("e22:e34")
                On Error Resume Next
                rCl.EntireRow.Hidden = Not rCl.Value
                On Error GoTo 0
            Next rCl
            End Select
        Application.Dialogs(xlDialogPrint).Show
    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 Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Add/Hide lines in invoice or qoute

    Quote Originally Posted by royUK View Post
    Maybe like this
    Sub Rectangle7_Click()
        Dim rCl As Range
        Select Case MsgBox("Do you want to hide unused rows?", vbYesNo Or vbExclamation Or vbDefaultButton1, "Empty Rows")
    
        Case vbYes
            For Each rCl In Range("e22:e34")
                On Error Resume Next
                rCl.EntireRow.Hidden = Not rCl.Value
                On Error GoTo 0
            Next rCl
            End Select
        Application.Dialogs(xlDialogPrint).Show
    End Sub
    It work, yes, thank you. is there a possibility to make it work as a hide/unhide toggle option? My problem is when I edit a quote, and add an item, it does not add the new line then..

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

    Re: Add/Hide lines in invoice or qoute

    Restore the lines after Printing
    Sub Rectangle7_Click()
        Dim bOK As Boolean
        Dim rCl As Range
        With Application
            .ScreenUpdating = False
    
            Select Case MsgBox("Do you want to hide unused rows?", vbYesNo Or _
                                                                   vbExclamation Or vbDefaultButton1, "Empty Rows")
            Case vbYes
                For Each rCl In Range("e22:e34")
                    On Error Resume Next
                    rCl.EntireRow.Hidden = Not rCl.Value
                    On Error GoTo 0
                Next rCl
                bOK = True
            End Select
            Application.Dialogs(xlDialogPrint).Show
            If bOK Then
                GoTo restore_lines
            Else: GoTo the_end
            End If
    restore_lines:
            For Each rCl In Range("e22:e34")
                On Error Resume Next
                rCl.EntireRow.Hidden = rCl.Value
                On Error GoTo 0
            Next rCl
    the_end:
            .ScreenUpdating = True
        End With
    End Sub

  5. #5
    Forum Contributor
    Join Date
    03-03-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Add/Hide lines in invoice or qoute

    Thanks, that's perfect!

  6. #6
    Registered User
    Join Date
    04-28-2010
    Location
    johannesburg south africa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Add/Hide lines in invoice or qoute

    I am trying to do the same thing, I don't really see how to use this though.
    I've pasted the code into the code of the sheet, but can't see which cells it is affecting, etc. Some guidance please?
    That is, on the hide part of the code.

+ 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