+ Reply to Thread
Results 1 to 6 of 6

Macro - Problem with user selected range passing into a formula

  1. #1
    Registered User
    Join Date
    06-24-2008
    Posts
    23

    Macro - Problem with user selected range passing into a formula

    This is probably a quick one.....I'm trying to enter a COUNTIF formula into a cell based on a range that is selected by the user. When I try a formula that takes only one parameter the macro works, but when I try it with my COUNTIF formula the macro does nothing.

    Please Login or Register  to view this content.
    Last edited by XL2008; 09-11-2010 at 10:41 AM.

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

    Re: Macro - Problem with user selected range passing into a formula

    Hello XL2008,

    If you want a single formula to return the count of the occurances of A3 then you need to use the Range's Address and not the Range Object.
    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!)

  3. #3
    Registered User
    Join Date
    06-24-2008
    Posts
    23

    Re: Macro - Problem with user selected range passing into a formula

    Hey Leith,

    It works perfect based on what I gave you.

    I forgot about one issue though when I was testing this before. When I select my range from another worksheet it doesn't pass the worksheet name into the formula so if for example I'm in Sheet1 and choose data for the range from Sheet2 A:A, my formula only gets the info A:A and doesn't refer to the sheet I chose the data from.

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

    Re: Macro - Problem with user selected range passing into a formula

    Hello xl2008,

    This version includes the sheet name in the formula.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Macro - Problem with user selected range passing into a formula

    Or
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    06-24-2008
    Posts
    23

    Re: Macro - Problem with user selected range passing into a formula

    Works perfect, thanks!

+ 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