+ Reply to Thread
Results 1 to 6 of 6

How to exclude hidden rows while running a code?

Hybrid View

heena.singh How to exclude hidden rows... 06-19-2013, 05:53 AM
:) Sixthsense :) Re: How to exclude hidden... 06-19-2013, 06:02 AM
heena.singh Re: How to exclude hidden... 06-19-2013, 06:06 AM
:) Sixthsense :) Re: How to exclude hidden... 06-19-2013, 06:11 AM
heena.singh Re: How to exclude hidden... 06-19-2013, 06:22 AM
:) Sixthsense :) Re: How to exclude hidden... 06-19-2013, 06:25 AM
  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    8

    How to exclude hidden rows while running a code?

    Need help with applying this code to only unhidden rows in selection. Currently, the code gives results in hidden rows as well.
    Also, Cells(i, 32) = "Analyst"
    While the code returns the analyst name, I need help in including Today's date in the same cell.
    Example: Analyst 19.6.2013 in the same format.
    Please help!

    Sub Highlight()

    Dim MyRange As Range

    Set MyRange = Selection

    ThisRow = Selection.Row
    LastRow = Selection.Rows.Count + ThisRow - 1

    For i = ThisRow To LastRow

    If Cells(i, 26) = "CHECK" Then

    Cells(i, 30) = "Ok"
    Cells(i, 31) = "Reviewed"
    Cells(i, 32) = "Analyst Today's Date"


    End If

    Next i


    End Sub

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to exclude hidden rows while running a code?

    Try like this...

    Sub Highlight()
    Dim MyRange As Range
    
    Set MyRange = Selection
    
    ThisRow = Selection.Row
    LastRow = Selection.Rows.Count + ThisRow - 1
    
    For i = ThisRow To LastRow
        If Rows(i).Hidden = False Then
            If Cells(i, 26) = "CHECK" Then
                Cells(i, 30) = "Ok"
                Cells(i, 31) = "Reviewed"
                Cells(i, 32) = "Analyst Today's Date"
            End If
        End If
    Next i
    
    End Sub


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    06-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: How to exclude hidden rows while running a code?

    Hi.

    Analyst Today's Date should be ABC 19.6.2013
    The above code does not provide today's date.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to exclude hidden rows while running a code?

    Change this line

    Cells(i, 32) = "Analyst Today's Date"
    To

    Cells(i, 32) = "Analyst " & Format(Date, "DD.MM.YYYY")

  5. #5
    Registered User
    Join Date
    06-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: How to exclude hidden rows while running a code?

    thanks a lot it works perfect!!

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to exclude hidden rows while running a code?

    Glad it helps you and thanks for the feedback

+ 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