+ Reply to Thread
Results 1 to 12 of 12

Data to count, The macro code. Help.

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    tr
    MS-Off Ver
    2007
    Posts
    75

    Data to count, The macro code. Help.

    Hi, friends.

    Total Computer how many= ?
    Total TV how many= ?
    I want the macro to count them.

    You want to help.
    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Data to count, The macro code. Help.

    Put
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in D7 and copy down.

    Put
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in E7 and copy down.


    Or here is an option if it has to be in a macro:
    Please Login or Register  to view this content.
    Last edited by Solus Rankin; 12-17-2013 at 03:00 PM.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    tr
    MS-Off Ver
    2007
    Posts
    75

    Re: Data to count, The macro code. Help.

    Hi Solus Rankin;
    Thank you very much.

    Red line I get the error.
    What's the problem?

    Sub test()
    Dim l As Long
    For l = 7 To UsedRange.Rows.Count
    Cells(l, 4).Value = Application.WorksheetFunction.CountIf(Range(Cells(l, 10), Cells(l, 17)), "Computer")
    Cells(l, 5).Value = Application.WorksheetFunction.CountIf(Range(Cells(l, 10), Cells(l, 17)), "TV")
    Next l
    End Sub

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Data to count, The macro code. Help.

    Where did you copy the code to?

    maybe change to
    Please Login or Register  to view this content.

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Data to count, The macro code. Help.

    Try this code......
    Please Login or Register  to view this content.
    Please find the attached sheet to see if this is what you want.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Data to count, The macro code. Help.

    FWIW:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-25-2013
    Location
    tr
    MS-Off Ver
    2007
    Posts
    75

    Re: Data to count, The macro code. Help.

    Hi JOHN H. DAVIS;
    Please Login or Register  to view this content.
    I want you,
    Red text instead
    The last line
    get. (uncertain because the last line.)
    Possible?

    This beautiful example
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Data to count, The macro code. Help.

    Will this work?

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-25-2013
    Location
    tr
    MS-Off Ver
    2007
    Posts
    75

    Re: Data to count, The macro code. Help.

    Sorry. you're right.
    Is it possible to do this?
    If the cell is empty,
    "0" not.
    get empty cells.

    (Example file
    10 row)

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Data to count, The macro code. Help.

    Maybe:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    01-25-2013
    Location
    tr
    MS-Off Ver
    2007
    Posts
    75

    Re: Data to count, The macro code. Help.

    great
    Thank you very much.
    dear JOHN H. DAVIS


    dear sktneer
    Thank you.

    dear Solus Rankin
    Thank you.

    Have nice day.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Data to count, The macro code. Help.

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. [SOLVED] Row delete macro is effecting record count formula and vlookup code. #REF!
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 14
    Last Post: 10-20-2013, 10:13 PM
  2. Row delete macro is effecting record count formula and vlookup code.
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 10-13-2013, 06:23 PM
  3. [SOLVED] Macro code to count number of unique rows in a sheet.
    By jsrakesh4u in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-02-2013, 06:44 AM
  4. [SOLVED] help - count code in worksheet1 & place count in worksheet2 next to appropriate code#
    By burnettec in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-30-2012, 05:09 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