Number of Cells/Rows/Columns With Formula

A few weeks ago I received this question from someone called LS:

Hi
I want to write a macro that counts the following
- Number of cells with formula
- Number of Rows with formula
- Number of Columns with formula
Please let me know if there is a way of doing it in Excel VBA

To find out the number of cells, rows, or columns with formula in active Excel worksheet is quite simple.

In my previous post, we already have the Excel VBA code on how to select all cells with formula, so we only need to tweak this macro a little bit and get the results that we looking for.

Sub NumberOfCellsWFormula()

    'select all cells with formula
    Cells.SpecialCells(xlCellTypeFormulas).Select

    'number of cells with formula
    Debug.Print Selection.Count

    'number of rows with formula
    Debug.Print Selection.Rows.Count

    'number of columns with formula
    Debug.Print Selection.Columns.Count

End Sub

The Excel VBA procedure above will simply print the number of cells, rows, and columns of current active Excel Worksheet that containing any formula in it. Please be sure to run it from Excel VBA windows with Immediate Window turn on (View » Immediate Window or CTRL+G).

In short, we only need to use Range properties Count, Rows.Count, and Columns.Count to get the number of selected cells, rows or columns.

FIN.

This entry was posted in Cells and Range, Workbook and Worksheet and tagged , , , , , , , , , , . Bookmark the permalink.

1,640 Responses to Number of Cells/Rows/Columns With Formula

  1. JP says:

    Isn’t it strange that this works:

    Cells.SpecialCells(xlCellTypeFormulas).Select
    Selection.Count

    but this doesn’t?

    Cells.SpecialCells(xlCellTypeFormulas).Count

  2. MUKUL RAWAT says:

    I have in my spreadsheet rows different records of golf scores of many golfers arranged with date chronologically. I transpose want to transpose & count only last twenty rounds for handicap calculations.How do I do it. I know how to transpose , but i do not know how to use only the last 20 rounds and ignore the previous scores. (example: tom has 37 rounds of golf. I want to count only 18-37 and not use 1-17.

  3. Pingback: Tummy Tuck Pictures

  4. Pingback: URL

  5. Pingback: how to get rid of acne scars

  6. Pingback: cheap weekend breaks

  7. Pingback: geburtstagskarten

  8. Pingback: Hotels in Assen

  9. Pingback: debt consolidation companies

  10. Pingback: reverse mortgages

  11. Pingback: debt management companies

  12. Pingback: reverse mortgage problems

  13. Pingback: bahamas real estate rentals

  14. Pingback: vimax brasil

  15. Pingback: Berufsunfähigkeitsversicherung

  16. Pingback: boxfresh for men

  17. Pingback: sofas

  18. Pingback: conveyancing

  19. Pingback: campervan hire

  20. Pingback: easter revision courses

  21. Pingback: fancy dress costumes

  22. Pingback: golf swing tips

  23. Pingback: plane parking games

  24. Pingback: open office

  25. Pingback: cybercrime expert

  26. Pingback: basement odors

  27. Pingback: Kindle Ebook Reader Test

  28. Pingback: persoonlijke lening

  29. Pingback: how to find a job in America

  30. Pingback: best iphone apps for kids

  31. Pingback: Fencing Installers North London

  32. Pingback: Fencing Installers North London

  33. Pingback: Landscape Gardeners London

  34. Pingback: magic of making up

  35. Pingback: buy cake pops

  36. Pingback: Ares Free Download

  37. Pingback: chamomile tea benefits

  38. Pingback: best buy coupon code

  39. Pingback: amazon coupon

  40. Pingback: Alternative Energy Projects

  41. Pingback: tax relief

  42. Pingback: san diego bankruptcy attorney

  43. Pingback: fiance visa

  44. Pingback: mas 200

  45. Pingback: carlsbad bankruptcy lawyer

  46. Pingback: black mold

  47. Pingback: Moulinex fresh express

  48. Pingback: Tour Scooter 2012/2013

  49. Pingback: Hochdruckreiniger Test

  50. Pingback: i gun app

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>