+ Reply to Thread
Results 1 to 6 of 6

Use string variable in formula

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Use string variable in formula

    Hello there,

    I'm trying to use a string variable when inserting formulas. Having looked at a couple of other threads I still cant figure out the problem with my code?

    Please Login or Register  to view this content.
    Hope you can help.
    Thanks










    I've attached a workbook with the code attached to it.
    Attached Files Attached Files
    Last edited by r2fro; 06-19-2014 at 05:53 AM. Reason: code update

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Use string variable in formula

    Space either side of & is required. That is first problem.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,289

    Re: Use string variable in formula

    You should also use Formula not FormulaR1C1 since you are passing an A1 style reference, not an R1C1 style one. And it's safer to enclose the sheet name in single quotes:


    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

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

    Re: Use string variable in formula

    Maybe: One of these?

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-16-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Use string variable in formula

    Thank you very much folks.

    The rompstomper strikes again with the wining code!

    Many thanks to you all!!

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,289

    Re: Use string variable in formula

    Glad to help. Thanks for the rep and kind comment.

+ 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. Replies: 4
    Last Post: 07-12-2013, 12:14 PM
  2. Using String Variable in VBA if Formula
    By manuj.chawla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2012, 06:33 AM
  3. Transferring a dynamically named string variable to another string variable.
    By Concorde Rules in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2012, 04:08 AM
  4. Using a string variable in data validation formula
    By little_pea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2008, 11:58 AM
  5. Using a string-variable in an excel formula
    By marcusr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2007, 07:04 AM

Tags for this Thread

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