+ Reply to Thread
Results 1 to 4 of 4

Reference VBA object within worksheet function "countifs"

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Newark, Delaware
    MS-Off Ver
    2010 Excel
    Posts
    13

    Lightbulb Reference VBA object within worksheet function "countifs"

    Hey guys, so I'm pretty new to VBA and I've been using it at my work a lot lately and I keep having a problem that my code isn't referencing the "=tier" in the countifs. Anyone know how to fix this?

    Please Login or Register  to view this content.
    Any help is very much appreciated
    Last edited by pwells; 06-26-2014 at 08:26 AM. Reason: code tags

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Reference VBA object within worksheet function "countifs"

    Tier is a variable but by enclosing it in quotes you are treating it as literal text and the function tries to match the actual word "tier". You need to concatenate the value onto the criteria string:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Reference VBA object within worksheet function "countifs"

    i think you need to put some "" round tier. I'll take a look.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  4. #4
    Registered User
    Join Date
    06-26-2014
    Location
    Newark, Delaware
    MS-Off Ver
    2010 Excel
    Posts
    13

    Re: Reference VBA object within worksheet function "countifs"

    Woah, that worked perfectly! Thank you so much for the help

+ 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] Countifs problem - Using the "OR" function or someting similar
    By shepherdc2814 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2014, 05:58 PM
  2. Replies: 1
    Last Post: 09-07-2012, 12:08 AM
  3. "The "sheets" method from the "_Global" object have failed."
    By mankit87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2011, 08:53 AM
  4. cell references in "COUNTIFS" function
    By mmrtech in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-30-2007, 04:25 PM
  5. [SOLVED] What is Error "Method "Paste" of object "_Worksheet" failed?
    By vat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2006, 04:10 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