+ Reply to Thread
Results 1 to 6 of 6

Select a range named and replace values

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Select a range named and replace values

    Hi, I have one excel file with values in Colum A. I want Replace 3/1/2013 & 7/1/2013 values with 3-1 and 7-1 each.

    For that I've created 2 Ranged names "date3" and "date7", that automatically select only cells with that values.

    I Want a Macro to Replace the "Selection" with spesific values. Example to replace 3/1/2013 with 3-1 I have this code

    Range("date3").Select 'This Line Doesn't work
    Selection.FormulaR1C1 = "3-1" 'This Line Replace The Selection

    I'm hable to copy a range named with this code
    Range("date3").Copy

    So, what is the way to select a Name in VBA?
    Thank you.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Select a range named and replace values

    Hi,

    Do you really need to change the values? Can't you just format the dates with "d - m" > This assumes you do mean 3rd January and 7th January. If your date is m/d/y then format as "m - d" instead.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-04-2013
    Location
    Here
    MS-Off Ver
    Excel 2010/2013
    Posts
    8

    Re: Select a range named and replace values

    Hi,

    Please Login or Register  to view this content.
    V-B-A

  4. #4
    Registered User
    Join Date
    03-26-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Select a range named and replace values

    Thank you both for your help

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Do you really need to change the values? Can't you just format the dates with "d - m" > This assumes you do mean 3rd January and 7th January. If your date is m/d/y then format as "m - d" instead.
    Yes, because I´m going to still work with that values and I need text no date, I try with your idea but on my excel i need double click on the current cell to apply the change :S, and the cell position ever going to be a variable value.

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    Here
    MS-Off Ver
    Excel 2010/2013
    Posts
    8

    Re: Select a range named and replace values

    Quote Originally Posted by Kamusksn View Post
    i need double click on the current cell to apply the change :S, and the cell position ever going to be a variable value.
    Try this :

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-26-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Select a range named and replace values

    Solved using Go To thanks.
    Last edited by Kamusksn; 04-08-2013 at 08:57 AM.

+ 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