+ Reply to Thread
Results 1 to 9 of 9

Formula converted to code Run time error 1004

  1. #1
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Formula converted to code Run time error 1004

    Hello experts

    '=IF(OR(P2={"B2C",""}),"B2C",IFNA(IF(VLOOKUP(P2,'GSTIN Verified'!$D$2:$H$10000,5,0)="ACT","B2B","B2C"),""))
    .Offset(1, 19).Formula = "=IF(OR(P2={""B2C"",""}),""B2C"",IFNA(IF(VLOOKUP(P2,'GSTIN Verified'!$D:$H,5,0)=""ACT"",""B2B"",""B2C""),""))"
    The above line is the formula which works while entering manually in a cell row2. I tried to convert the formula into code and get the result but I am getting an erro. Can someone please help me to correct the code (Starts with .OFFSET In the above). I am getting a Run time error 1004.
    Thank you in advance.
    Last edited by RAJESH SHAH; 01-31-2023 at 11:25 AM. Reason: #Solved by John Topley

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    27,998

    Re: Formula converted to code Run time error 1004

    No file ... no answer!!!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Formula converted to code Run time error 1004

    The file is too huge to share with multiple sheets of data. If I share a sample data then I will not be able to get and check the correct result. Then too, let me try and ready a sample file if possible with minimum data.

  4. #4
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Formula converted to code Run time error 1004

    I am not able to upload even 25 rows of data and as the formula is connected to columns A to AR I can't delete the columns too.
    Can I share a link to the file please ?

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    27,998

    Re: Formula converted to code Run time error 1004

    Remove sheets not referenced in the formula.

    Something very wrong if you cannot upload 25 rows!!!!! Try as xlsb file.
    Last edited by JohnTopley; 01-31-2023 at 10:20 AM.

  6. #6
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Formula converted to code Run time error 1004

    I have only one sheet in the workbook. A new sheet will be created with data after I run the macro.

  7. #7
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Formula converted to code Run time error 1004

    I tried 5 rows of data and that too was rejected as the file is too large. I tried to save as xlsb. That too failed.
    Hope someone can just see the formula, understand and correct it.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    27,998

    Re: Formula converted to code Run time error 1004

    Try

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Formula converted to code Run time error 1004

    I missed the blank to give additional "". Your correction is perfect. Thanks once again John Topley.
    Sorry I am not able to give reputation as it is showing some message. Anyways Thanks.
    Last edited by RAJESH SHAH; 01-31-2023 at 11:25 AM.

+ 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. Run Time Error 1004- Long Array Formula in VBA (How to split the VBA code)
    By Shamis12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2021, 12:13 PM
  2. Run-time error '1004': in vba code
    By ENO111 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2018, 11:34 AM
  3. Run Time Error 1004 (VBA Code)
    By Cheezee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-26-2015, 04:47 PM
  4. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  5. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  6. Run Time Error 1004 on code
    By aftabn10 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2011, 09:46 AM
  7. Code Run-time error '1004'
    By superbob in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2010, 09:18 AM

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