Results 1 to 4 of 4

input box to change formula in calculated field

Threaded View

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    input box to change formula in calculated field

    Hi,
    I have a problem.
    I was thinking about my macro, and i need it to go like this:

    User puts a value o percentage loss that he would like to define and then macro change this value in the calcualted field.
    i dont really know how to write it down. i have something like this so far.
    I would like to look like this:

    User puts a value that of index that he wants (10% makes 0.9/1/1.1, 20% makes 0.8/1/1.2 in the following formula) and macro change the formula in the calculated field.

    Sub calculate_field()
    Dim w As Worksheet, p As PivotTable
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
        End With
      For Each w In ThisWorkbook.Worksheets
      For Each p In w.PivotTables
     p.CalculatedFields("Index").StandardFormula="=IF(Sales<>production,IF(sales=0,2,IF(production=0,-2,IF(sales/production<0.9,2,IF(sales/production<1,1,IF(sales/production>1.1,-2,-1))))))"
        p.Update
      Next
    Next  
    End Sub
    Now i get wrong numbers of argument or invalid property assignment :/
    Last edited by mumsys; 08-08-2013 at 09:45 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adding % Change Calculated Field
    By lj8675309 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-03-2013, 03:05 PM
  2. Change an existing field to a calculated field using Show Values as
    By Excel_vba in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-16-2012, 01:50 PM
  3. Replies: 1
    Last Post: 09-01-2011, 01:19 PM
  4. Replies: 0
    Last Post: 07-10-2010, 03:02 PM
  5. Replies: 0
    Last Post: 02-04-2010, 07:26 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