Results 1 to 3 of 3

counting number of rows

Threaded View

  1. #1
    Registered User
    Join Date
    06-16-2013
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    8

    counting number of rows

    I have two worksheets- Sheet1 and Sheet2

    In Sheet1, I want to count the number of row are not bold. And I want to show this count in a cell in Sheet2.

    I currently have something like this:

    Dim cnt as Integer
    
    cnt = Range("G1").CurrentRegion.Rows.Count
     
     For Each Row In Range("G1")
         If Row.Font.Bold = True Then
            cnt = cnt + 0
    
    End If
    Next
    
        Application.Goto (ActiveWorkbook.Sheets("Sheet2").Range("B2"))
        ActiveCell.Value = cnt
    But the macro is returning me the count of all the rows instead, including the bold ones.

    How should I change the macro?

    Thanks!

    Moderator's note: Code tags added for you - this time
    Last edited by FDibbins; 06-23-2013 at 12:32 AM.

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