+ Reply to Thread
Results 1 to 5 of 5

How to pass cell Value as String in VBA Formula - Avoid them to become as range

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    delhi, india
    MS-Off Ver
    Excel 2007
    Posts
    35

    How to pass cell Value as String in VBA Formula - Avoid them to become as range

    Hi All,

    I have one code column, Codes are like A03-01, A03-02 and so on. When i pass this in Sumifs Formula in VBA, A03-01 code becomes A3-1 and A3 is treated as range.

    Please help me to understand, how can i pass A03-01 as string in the VBA Formulas.

    Should be This: "=SUMIFS(Sum_Range,Criteria_Range,A03-01)"

    But Become: "=SUMIFS(Sum_Range,Criteria_Range,A3-1)"

    now A3 becomes Cell Adddress.

    Thanks in Advance!

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: How to pass cell Value as String in VBA Formula - Avoid them to become as range

    maybe wrap the A01-03 in double Quotes?....you might have to play with the double double quotes because of being in VBA....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to pass cell Value as String in VBA Formula - Avoid them to become as range

    Text strings go between double quotes.

    =SUMIFS(Sum_Range,Criteria_Range, "A03-01")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    03-08-2010
    Location
    delhi, india
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: How to pass cell Value as String in VBA Formula - Avoid them to become as range

    Thanks judgeh59, its is helpfull.

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: How to pass cell Value as String in VBA Formula - Avoid them to become as range

    excellent - glad we could help...

    If this has been completed to your satisfaction, please set the thread to Solved...If you feel we deserve an increase in our reputation, feel free to click on the star in the lower left of the thread. Remember, someday when you help somebody they may add to your rep points, and it could be us...just a thought...

+ 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. Pass Cell Values in a Dynamic Range to String
    By Jimmy0306 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2013, 01:54 PM
  2. Replies: 2
    Last Post: 10-21-2011, 04:13 AM
  3. How concate the string with number in Excel to pass in Range
    By dhurva in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2010, 11:17 AM
  4. Replies: 4
    Last Post: 10-20-2009, 10:00 AM
  5. pass cell value as string to function
    By fybar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 12:40 AM

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