+ Reply to Thread
Results 1 to 2 of 2

Write Excel formulas into VBA code

  1. #1
    Forum Contributor
    Join Date
    04-03-2014
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    160

    Write Excel formulas into VBA code

    Hi Guys,

    I am trying to write some formulas into a VBA code but as my beginner knowledge does not suffice, the result does not do the Job.
    Here are the formulas:

    =IF(COUNTIFS([Material];[@Material];[Werk];60)>0;TRUE();FALSE())

    =IF(SUM(SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"L");SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"K")*(-1))>0;TRUE();FALSE())

    =IFERROR(((SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"L")-SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"K"))/SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"L")*(100))<=50;FALSE())

    =IF(ISBLANK([@Material]);"";IF(AND([@[Prüfung Werk 60]];[@[Prüfung Wert]]);"keine Fehler";IF(AND([@[Prüfung Werk 60]];[@[Prüfung Wert]]=FALSE());"Preis < Kosten";IF(AND([@[Prüfung Werk 60]]=FALSE();[@[Prüfung Wert]]);"W60 fehlt"; "W60 fehlt & Preis < Kosten"))))

    =IF(SUM(SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"L");SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"K")*(-1))<0;SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"L")-SUMIFS([Preis aus IDoc];[Material];[@Material];[W];"K");"")

    I have enclosed the Excel file, the formulas that I am trying to write in the code are in columns J, K, L, M, N.
    If you could give me a hand with that it would be awesome ;-)

    Many thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Write Excel formulas into VBA code

    Is the purpose of this to provide the formulas for all the way down the column? If so, vba should not be necessary. I can see that you are already using excel tables. One of the things about excel tables is that they do copy the formula all the way down. Furthermore, you can delete the table rows, but he table will remember the formulas.

    If this is a routine report, then I suggest that you keep a copy of it with a blank table in it and copy and paste the data into it. I also have code that I clears out the contents of a table. I posted it at the end. Just pass the tab name and table name to it.

    See this wiki for working with tables: http://www.utteraccess.com/wiki/inde...ables_in_Excel.

    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. [SOLVED] Write Excel formulas in VBA code
    By vio.coman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2015, 10:56 AM
  2. Error in code to write formulas into cells
    By kylecodesinBoston in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2015, 02:24 PM
  3. Need help to write vba code in excel to do the below ASAP
    By ohadshay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2013, 05:40 PM
  4. [SOLVED] Should I copy text, use formulas or write VBA Code
    By Decar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2013, 12:19 PM
  5. Excel closes when using VBA to write VBA code
    By btoback in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2007, 03:42 PM
  6. write excel formulas
    By bc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-02-2005, 06:17 PM
  7. how to write formulas in excel for money to days
    By wolfmasterr in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 06-01-2005, 07:05 PM

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