+ Reply to Thread
Results 1 to 3 of 3

VBA to create a column with a formula relative to each row

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    VBA to create a column with a formula relative to each row

    Hi All,
    So, the user selects a column within the data that he/she wants to remove a preceeding comma from (sometimes space comma). So I want to create a column to the right of the data with a formula in it to achieve this. This will actually be a series of commands but I figure if I can figure this out, I can get the rest. The formula would be (assuming that Column U is selected)

    =TRIM(MID(TRIM(U2),IF(LEFT(TRIM(U2),1)=",",2,1),254))

    Here's my code
    Please Login or Register  to view this content.
    It's not working. I get an error on that last line naturally.
    Thanks
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA to create a column with a formula relative to each row

    Hi ChemistB,

    maybe :

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: VBA to create a column with a formula relative to each row

    Thanks Karedog, I will test it tomorrow.

+ 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] Add relative formula to next column
    By babymax in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-10-2016, 03:53 PM
  2. [SOLVED] VBA to create a relative formula in a conditional format (rather than an absolute formula)
    By The_Snook in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2016, 08:00 AM
  3. Use VBA to create and insert an indirect relative formula
    By cdratz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2015, 08:28 PM
  4. [SOLVED] absolute column and relative row not working in my formula???
    By ciapul12 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-15-2014, 02:29 PM
  5. Replies: 2
    Last Post: 05-26-2009, 05:55 PM
  6. Code to auto populate a relative formula into a column
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2009, 12:30 PM
  7. Create cell formula from a relative position
    By Geoff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2005, 05:19 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