+ Reply to Thread
Results 1 to 3 of 3

Converting formula to code

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

    Converting formula to code

    Have ben trying to add some code to my spreadsheet, and not getting anywhere fast.

    Currently the formula I'm using is...

    =IF(E6="AR Coating Type","",(LOOKUP($E6,'Calc Sheet'!$O$2:$O$21,'Calc Sheet'!$P$2:$P$21)))

    Tried to convert this to code and came up with this..

    If Target.Column = 5 Then
    With Target.Offset(0, 1)
    .FormulaR1C1 = _
    "=IF(RC5="AR Coating Type","""","LOOKUP(RC5,'Calc Sheet'!R2C15:R21C15,'Calc Sheet'!R2C16:R21C160))"
    .Value = .Value
    End With

    But its not working and keeps generating a Syntax Error.

    Any ideas which bit I've got wrong.
    Thanks,
    Gavin

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Converting formula to code

    I don't know what the rest of your code is doing, but try this .

    If this does not work then I suggest you post a dummy workbook. And best put your code in code tags please. Click the # character in advanced edit.

    Code:
    Please Login or Register  to view this content.
    Last edited by JapanDave; 12-08-2011 at 11:01 AM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Converting formula to code

    Gavster

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ 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