+ Reply to Thread
Results 1 to 5 of 5

count rows in new open excel

  1. #1
    Registered User
    Join Date
    11-06-2011
    Location
    NOTAPPLICABLE
    MS-Off Ver
    Excel 2003
    Posts
    1

    count rows in new open excel

    Hello,

    I am opening new excel file using my current excel file (in which I have wrote macro)
    I can read the current excel file total number of rows using following line
    Please Login or Register  to view this content.
    following error appears "unable to get the CountA property of the WorksheetFunction class"

    Thanks in advance for your suggestions

    Regards,
    Nitin Salunkhe
    Last edited by Leith Ross; 11-06-2011 at 12:56 PM. Reason: Added Code Tags

  2. #2
    Forum Contributor
    Join Date
    11-25-2010
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    120

    Re: count rows in new open excel

    Hi there,

    Without an example I'm not sure why you would want to know the amount of rows, I assume there must be data in column A.

    Anyway instead of initiating a new instance of Excel you can maybe do it like this:

    Please Login or Register  to view this content.
    lifesigns
    If the post was helpful please click the black star on the bottom left to add some reputation and mark your thread as SOLVED.

    A day with nothing new achieved or learned, albeit however small, is a day lost forever?

    Constant Never Ending Improvement

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: count rows in new open excel

    Please avoid Select & Activate in VBA

    Please Login or Register  to view this content.



  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: count rows in new open excel

    Usually when you are active in one instance of excel, it doesnt allow you to perform an action in another instance. Hence, instead of starting another instance, just add a workbook thru -
    Please Login or Register  to view this content.
    Then proceed to count.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: count rows in new open excel

    Hello smarty.1211,

    Welcome to the Forum!
    Your syntax is correct until the last statement. Here is the corrected and working code.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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