Results 1 to 7 of 7

Unknown error in my macro

Threaded View

newtomacros12 Unknown error in my macro 04-24-2013, 06:35 PM
MarvinP Re: Unknown error in my macro 04-24-2013, 06:41 PM
newtomacros12 Re: Unknown error in my macro 04-24-2013, 06:49 PM
newtomacros12 Re: Unknown error in my macro 04-24-2013, 06:51 PM
Richard Buttrey Re: Unknown error in my macro 04-24-2013, 06:52 PM
newtomacros12 Re: Unknown error in my macro 04-24-2013, 07:01 PM
Richard Buttrey Re: Unknown error in my macro 04-25-2013, 05:18 AM
  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Unknown error in my macro

    I am running a macro to hide all rows that have a value of "0" and print the rest. So it does just that very well however it hides the last row and I can't figure out why. So for example I have 10 rows with data, only 9 rows print. Please help because I can't figure it out.

    Sub Button2_Click()
    
    Sheet4.Unprotect Password:="1"
    
    Dim rw As Long
    Dim rng As Range
    Dim cell As Range
    
    
    Application.ScreenUpdating = False
    
    Set rng = Sheets("Test Reg UC").Range("b11:b63")
    With rng.Columns(1)
    For Each cell In rng
    If Application.WorksheetFunction.CountA( _
    .Parent.Cells(cell.Row, 1).Range("b2")) = 0 Then _
    .Parent.Rows(cell.Row).Hidden = True
    Next cell
    .Parent.PrintOut
    .EntireRow.Hidden = False
    End With
    Application.ScreenUpdating = True
    
    Sheet4.Protect Password:="1"
    
    End Sub
    Any additional questions I would be more then happy to clarify anything.
    Last edited by Richard Buttrey; 04-24-2013 at 06:53 PM.

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