+ Reply to Thread
Results 1 to 5 of 5

Run excel formula through VBA

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    7

    Run excel formula through VBA

    I am trying to VLOOKUP some value in 2 sheets and if the value is found then i am putting a hyperlink on the Sheet 1 cell to point it to the Sheet 2 cell.
    I have written an Excel formula for the same and it is working fine. But i am unable to convert it into a VBA formula. I tried many combinations, but i am unable to understand what i am doing wrong.
    Excel formula:


    Please Login or Register  to view this content.

    VBA formula which i have tried:

    Please Login or Register  to view this content.
    P.S.: Do not worry about the row and column indexes. I wrote the formula for test file and writing the vba for the master file.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Run excel formula through VBA

    When you are trying to enter a formula that uses R1C1 notation you need to use FormulaR1C1 instead of Formula.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Run excel formula through VBA

    You mean like this:

    Please Login or Register  to view this content.
    I tried the above..but its still not working..

    If possible, can you help me in re-writing this formula into vba?

    Please Login or Register  to view this content.
    Last edited by bagadiamohit; 03-25-2015 at 03:42 AM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Run excel formula through VBA

    Almost, you haven't got the range reference right.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-17-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Run excel formula through VBA

    Oops! That was a small one. Somehow, i missed it out. Thanks Noorie.

    Now, the code is working fine. But I got a new problem now.

    Is there anything wrong with the ""address"" which i have mentioned in the formula?

    Because whenever i am trying to run the macro, a popup is being opened and asking for File names.

    I am pasting my entire code here:

    Please Login or Register  to view this content.

+ 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. Replies: 2
    Last Post: 03-21-2014, 11:43 AM
  2. Macro: Applying formula to multiple cells in excel (formula editing)
    By city in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2012, 06:41 AM
  3. Replies: 0
    Last Post: 03-19-2012, 07:32 PM
  4. Replies: 1
    Last Post: 03-04-2012, 12:03 AM
  5. [SOLVED] Excel 2002 formula displayed not value formula option not checked
    By Dean in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2006, 10:35 AM

Tags for this Thread

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