+ Reply to Thread
Results 1 to 5 of 5

Automated =Left, =Left(Right), =Right & Concatenate

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Automated =Left, =Left(Right), =Right & Concatenate

    Hi All,

    I'm back once again with a problem I think should be relatively easy to solve but I'm guessing I'am showing my novice skills are building code. But I am learning

    Anyway down to the problem at hand

    I have a list of Rows with Data about the way a product is performing for a customer in one row which has locality data I need to separate using the =left , =left(right) , and =right function but the issue is that I need to do this in VBA and the locality column will move its row location over time so I need to use a Find "Locality" column by name within the Left and right function and then need to replicate it till the last row of data.

    I have attached an excel file with the left and right cells done in standard excel formula but I need to replicated in VBA, if anyone could help that would be greatly appreciated.

    Regards
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Automated =Left, =Left(Right), =Right & Concatenate

    I don't understand your request. Why would you use the Find "Locality"? Will its column change with time? Can you explain a little more, please?

  3. #3
    Registered User
    Join Date
    09-14-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Automated =Left, =Left(Right), =Right & Concatenate

    Hi p24leclerc,

    Yes due to the database this data is pulled out of the location of the "Locality" Column will change as new columns of data are added so I need the report to be able to find the column based on the name of the column header.

    So basically what i need to do is with the locality row how it has 3 postcodes combined into 1 line I need the break them apart. I am planning to do this with the Left and right functions.


    here is the basic code
    ActiveCell.FormulaR1C1 = "=Left(RC[-9],4)"

    I need to change the RC[-9] to as something like below

    ActiveCell.FormulaR1C1 = "=LEFT((cells(2,locality),4)"

    thanks for your time

    i hope this makes more sense

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

    Re: Automated =Left, =Left(Right), =Right & Concatenate

    First you use a FIND command to spot the "Locality" in row 1 and store the column. Then you insert that into your macro formula.

    Please Login or Register  to view this content.
    _________________
    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!)

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Automated =Left, =Left(Right), =Right & Concatenate

    What about the location of the 3 columns containing the LEFT, RIGHT,etc value? Will they change place also? Would you like the macro to create new columns for them?

+ 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