+ Reply to Thread
Results 1 to 7 of 7

Convert string to range

  1. #1
    Forum Contributor
    Join Date
    01-18-2010
    Location
    Bentley, NM
    MS-Off Ver
    Excel 2010
    Posts
    229

    Convert string to range

    I have some code that gives me a cell range in the form of a string i.e. "N11". How can I convert this to a range, so that I can manipulate it as such?

    Here is my code:

    Please Login or Register  to view this content.
    I want to then change formulaText to "O11" from "N11", for example. Please ignore the most likely crappy Find function at the beginning. I plan to change that later.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Convert string to range

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    01-18-2010
    Location
    Bentley, NM
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Convert string to range

    Quote Originally Posted by TMS View Post
    Please Login or Register  to view this content.

    Regards, TMS
    The bolded line produces a "Method 'Range' of object global failed" message.
    The line above that gives me the value of the cell which is the product of the formula contained within. However, I just need to take the formula in the cell and add one column to it so that "=+N11" becomes "=+O11".

    Thanks!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Convert string to range

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Convert string to range

    Cancel that, try this:

    Please Login or Register  to view this content.
    You do know that the plus (+) is redundant in the formula?


    Regards, TMS

  6. #6
    Forum Contributor
    Join Date
    01-18-2010
    Location
    Bentley, NM
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Convert string to range

    Works great! Yeah, the '+' is leftover from the previous user, so I wasn't sure if I needed it.

    Thanks!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Convert string to range

    You're welcome. Thanks for the rep.

    No, you don't need it. But I wasn't sure why you had it and that's why I used separate replace statements in case it wasn't always present.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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] Convert String from Excel Range.Value to Equation in VBA
    By Kalithro in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2013, 03:50 PM
  2. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM
  3. Replies: 2
    Last Post: 12-12-2012, 04:19 AM
  4. Convert string to range
    By ZacharyBass in forum Excel General
    Replies: 2
    Last Post: 11-26-2012, 12:58 AM
  5. Convert String to Row Range
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2011, 04:07 PM
  6. Convert string to range
    By mavve2004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2010, 07:07 PM
  7. Convert string to range
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-26-2006, 06:32 AM
  8. [SOLVED] convert a string to range?
    By JK in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-19-2006, 08: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