+ Reply to Thread
Results 1 to 10 of 10

range offset inside range.foruma function

  1. #1
    Registered User
    Join Date
    12-08-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    Standard 2013
    Posts
    83

    range offset inside range.foruma function

    Hi, I'm making a function that will change a person's name format from "Smith, John" to "John Smith" using the range.formula function

    My code is below. It works, except it gets the age old problem of having absolute references (i.e. it only pulls from A5) I want it to be able to slide down. I want to be able to select an entire range in a single column (e.g. e5 to e10) and produce the new name format in these cells by taking the raw info from let's say column D (D5-D10). Later I can of course create a variable and ask the users for the desired offset. I am still learning the nuances of range versus select and all that. I could maybe figure it out eventually but don't have tons of free time at the office. Much appreciated for your support and help. I love learning coding and OOP and VBA is how I can learn it on work time!

    The commented out line below is what I tried but didn't work. returned a #name error but no compile error or anything.

    Please Login or Register  to view this content.

    THANKS!!!

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: range offset inside range.foruma function

    Please attach an Excel sample file showing the data lay out and values.
    This will explain ,how column D is used
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: range offset inside range.foruma function

    Hi

    Try like that:

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: range offset inside range.foruma function

    See next code and file attached
    Make the selection of a cell and launch the macro (you can use Control + a)
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: range offset inside range.foruma function

    A remake in case selection is covering several cells ...!
    Please Login or Register  to view this content.

  6. #6
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: range offset inside range.foruma function

    Quote Originally Posted by PCI View Post
    A remake in case selection is covering several cells ...!
    Please Login or Register  to view this content.
    Question is: is OP wants to put formula in cells or just results of swapping.

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: range offset inside range.foruma function

    Question is: is OP wants to put formula in cells or just results of swapping.
    Yes that 's why an Excel sample file will help to understand the need ...!

  8. #8
    Registered User
    Join Date
    12-08-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    Standard 2013
    Posts
    83

    Re: range offset inside range.foruma function

    Wow lots of quick responses as I was getting my hair cut.

    In answer to the example this is what I want it to do
    Namereverse NormalName
    Doe, Jody L Jody L Doe
    Doe, Craig R Craig R Doe

    The 2nd column is formulaic.
    The formula is the one in the code.
    Normally the 2nd column would be blank. Imagine it's blank and you only have column 1. I want to select entire column two and have it look at column one to get the data.

    I'm not married to the method taken above. Anything that will return the format like the split function above.

    Sorry I haven't tried anybody's code yet because I just got back. I'll try it now.

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: range offset inside range.foruma function

    Your data sample is welcome, see a remake of the code
    Just select some cells to treat and launch the macro, cells value will be updated

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-08-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    Standard 2013
    Posts
    83

    Re: range offset inside range.foruma function

    Thanks for your responses. Treat V2.0 does the trick perfectly!

    I wish I could have spent more time trying to figure this out on my own and exploring different options but unfortunately this little thing called work gets in the way. I feel they're indulging me a little or maybe it's just my paranoia but it is useful learning this stuff and so interesting. I'm gradually learning more and more, step by step. Thanks y'all

+ 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] Is it possible to change a Named Range's value inside a Function?
    By mynameisnfs in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-25-2018, 08:19 PM
  2. Replies: 3
    Last Post: 08-14-2017, 06:26 AM
  3. [SOLVED] Help! - Copy Range (Sheet1,A10:F50), Paste Range (Sheet 2,A1:F41), Offset Range & Repeat
    By cjtimmer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-30-2015, 06:27 PM
  4. [SOLVED] Need IF statement (inside of Linest Function) that will select range based on dates
    By cpkrehbiel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2014, 09:22 PM
  5. Choosing Name Range inside Index / Match Function
    By gallow in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-05-2012, 07:08 AM
  6. Function inside Macro that move a range rows if cells are used
    By oguilamo in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 08-29-2012, 11:51 PM
  7. Using a range variable inside a excel function
    By Michael in forum Excel General
    Replies: 2
    Last Post: 11-14-2005, 10:55 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