+ Reply to Thread
Results 1 to 4 of 4

Row counter

  1. #1
    Registered User
    Join Date
    06-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    92

    Row counter

    Hello all, currently trying to get this code:

    Please Login or Register  to view this content.
    to work, I would like it to count the rows on sheets 1 and 3 and compare it to a cell in sheet 2, and if it is okay continue, if it is not throw an error message.
    Is this the correct method of doing it? Can anybody help?

    Thank you.

    Regards,
    Usman.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Row counter

    You do not need the set before rowcount because rowcount is not an object.
    There would be no point of turning ws2.Range("A55") into ws2.Range("A55").row since it is obvious that ws2.Range("A55").row = 55.
    <> means not equal, and so: If RowCount <> 55 then

  3. #3
    Registered User
    Join Date
    06-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Row counter

    Hello, thank you for the reply.

    The row number will be determined by a value inside a cell. Inside Cell A55 there will be a value such as 11, 38, 4838 etc.

    How would that affect it?

    Regards,

    Usman.

  4. #4
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Row counter

    My mistake.

    Assuming you set the ws2 to equal a worksheet, then

    In that case: If Not ws2.Range("A55") = RowCount Then should work.
    As would: If ws2.Range("A55") <> RowCount Then, they should mean the same thing.

    How about:

    Please Login or Register  to view this content.

+ 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