+ Reply to Thread
Results 1 to 6 of 6

convert formula to code

  1. #1
    Registered User
    Join Date
    02-24-2007
    Posts
    84

    convert formula to code

    I've just got this formula from a general thread I started, and it works brilliantly.
    =LEFT(A34,6)&MID(a34,8,1)

    I'd like to run it as a bit of code attached to the worksheet, but my version doesn't work.

    Please Login or Register  to view this content.
    Any ideas (probably a very simple error)?

    Many thanks,
    Gavin
    Last edited by gavster; 11-29-2010 at 07:29 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: convert formula to code

    Try
    Please Login or Register  to view this content.
    Last edited by royUK; 11-22-2010 at 11:40 AM. Reason: missed part of formula when pasting
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

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

    Re: convert formula to code

    Take the second = sign out of your coded formula.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    02-24-2007
    Posts
    84

    Re: convert formula to code

    Sorry for the delay in replying to your posts, not been at work for a few days.

    I've tried both of the solutions posted and can't get them to work.

    So I've zipped a small version of the file for you to look at.
    Basically the run number is entered in column A, and I want the code to put the shortened version in column AD on the same row.

    As you can see, so far I've been using the formula I was given in each cell, but would prefer to have this as code so all the cells are clear until needed.

    Thanks in advance,
    Gavin
    Attached Files Attached Files

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: convert formula to code

    Try this
    Please Login or Register  to view this content.
    Note: one problem was that the offset was wrong

  6. #6
    Registered User
    Join Date
    02-24-2007
    Posts
    84

    Re: convert formula to code

    Cheers Roy.
    Now sorted.

    Thanks,
    Gavin

+ 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