+ Reply to Thread
Results 1 to 3 of 3

formula works in cell but doesn't work in vba

Hybrid View

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2007
    Posts
    12

    formula works in cell but doesn't work in vba

    hye....what is the error in this code??? when i try this formula in cell, it works

    =INDIRECT("X" & ROW() - 1)
    but when i apply in macro, it shows error... can anyone help me to sort it out?? thank you...

    
    Sub celldown()
    Workbooks.Open filename:=Range("E6")
    Range("X2:X700").Formula = "=INDIRECT("X" & ROW() - 1)"
    
    End Sub

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,703

    Re: formula works in cell but doesn't work in vba

    Try this:

    Range("X2:X700").Formula = "=INDIRECT(""X"" & ROW() - 1)"
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: formula works in cell but doesn't work in vba

    Thank you so much....it works....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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