+ Reply to Thread
Results 1 to 7 of 7

CountA does not work

  1. #1
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    CountA does not work

    The issue I have is this: Whenever a new CellX that is not found on ws2 an error of Error 1004 Application defined or object-defined error on the last part of code: "ws2.Cells(emptyRow, emptyCol).Value = DateAdd("d", -1, Date)" keeps popping up. It still enters the data the way I want, but the rest of the code doesn't run after that error comes up. When I take that part of code out, it works without having any errors, but it does not add the date in the empty column beside Res.

    I hope this makes sense with the code I provided. Is it something with the emptyCol= function?

    Please Login or Register  to view this content.

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

    Re: CountA does not work

    Can you please explain what you are trying to do with this line of code?

    Please Login or Register  to view this content.



    It should be

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.
    Please confirm


    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
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: CountA does not work

    I tried looking up the arguments for CountA, but I could not find it. I was given a variation of this code long ago and am thinking now that it may not be needed.

    The Rows(Res) is what is counted. The range is the range of cells to count within

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CountA does not work

    Where are you trying to put the date(s)?
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: CountA does not work

    For a new name (CellX), I want dates in cells 1, 2, and 7. If the name (CellX) is already there, then in an empty column one the same row as the CellX.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CountA does not work

    I think you need to re-arrange your code a little.

    Give this a try.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: CountA does not work

    I see how that makes sense, but my other code that works for me seems to have it arranged in my original way. Oh well.

    Thank you for your help. I have been working on this for a while now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Counta
    By HNoel33 in forum Excel General
    Replies: 2
    Last Post: 11-14-2013, 01:51 PM
  2. Why dynamic range doesnt work with COUNTA
    By Kushal_1991 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-31-2013, 11:17 AM
  3. COUNTA function in VBA - won't work!
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2006, 05:05 AM
  4. COUNTA
    By Karen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2006, 05:50 PM
  5. using COUNTA
    By DougMc in forum Excel General
    Replies: 4
    Last Post: 05-29-2005, 08:05 PM

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