+ Reply to Thread
Results 1 to 6 of 6

Insert Formula with VBA

  1. #1
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Insert Formula with VBA

    Hi All,
    I have little peace of code that I need help with it. I'm trying input formula with VB, formula should be place into cells, dynamic range. Here is my code:
    PHP Code: 
    Set DataRange Range("J10"Range("P65536").End(xlUp))
        
    DataRange.Formula _
        
    "=IF(ISNA(VLOOKUP(J10,Currency!$C$12:$D$184,2,FALSE)),"1",VLOOKUP(J10, Currency!$C$12:$D$184,2,FALSE))" 
    I must be doing something wrong with syntax or something and I can't see what I'm doing wrong. I got "Compile error: Expected: expression". Any thoughts on this would be greatly appreciated
    Thanks a lot
    Izet

  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: Insert Formula with VBA

    Try this
    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Re: Insert Formula with VBA

    Wow that's was quick, thanks a lot royUK.

    Another quick question, is there a way I can fill down this formula in Column M10 and down based on that DataRange example J10 true what ever is data range .

    Izet

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

    Re: Insert Formula with VBA

    Quote Originally Posted by izet99 View Post
    Wow that's was quick, thanks a lot royUK.

    Another quick question, is there a way I can fill down this formula in Column M10 and down based on that DataRange example J10 true what ever is data range .

    Izet
    Not really sure exactly what you mean

  5. #5
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Re: Insert Formula with VBA

    Hi,

    I got formula in Column M10, now I would like to FillDown same formula for the rest of the cells based on DataRange in Column J10 thrue what ever will be last row in J column

    J--K--L--M
    1---------formula
    2---------FillDown
    3---------FillDown
    4---------FillDown
    5---------FillDown

    Thanks a lot.

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

    Re: Insert Formula with VBA

    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

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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