Consulting

Results 1 to 12 of 12

Thread: Insert new column with a Formula

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Aug 2019
    Posts
    2
    Location

    Insert new column with a Formula

    Hello

    Information:
    Excel with data (amounts and text) from column A to AQ.
    Columns needed for the forumla are:
    Column C [Document Type] with text or empty
    Column X [FA Posting Category] with text or empty
    Column Y [FA Posting Type] with text or empty
    Column AC[FA Entry Type] with text "Fixed Assets" or empty

    The formula I need is:
    =IF(X2="Disposal";IF(Y2="Invoice";X2;"Liquidation");Y2)

    I want VBA to insert that formula in all rows where column AC [FA Entry type]="Fixed Assets" (or alternatively add one more condition i.e. if(AC="Fixed Assets";below formula;"")

    I tried using this one but it doesnt work.
    Sub Test()
    Dim Rng As Range
    Columns("AR:AR").Insert
    Set Rng = Range("AR2:AR" & Range("B2").End(xlDown).Row)
    Rng.FormulaR1C1 = "=IF(X2="Disposal";IF(Y2="Invoice";X2;"Liquidation");Y2)"
    End Sub
    Last edited by Bob Phillips; 08-16-2019 at 10:54 AM. Reason: Added VBA tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •