Consulting

Results 1 to 6 of 6

Thread: Solved: UPDATE FORMULA

  1. #1

    Solved: UPDATE FORMULA

    Hi All,

    I have a workbook with a main sheet with formulas and the values are dependent on the sheets I am adding. I want the sheet with formula to update after I add the sheet where it is dependent. What I actually do now is to double click the cells with formula one by one to get the result. Is there a code that I can place on the main sheet so that after I add a sheet, i will just hit a button to update?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    This should happen automatically already.

    What problem do you have exeactly?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    You could try putting this code to a button in your main sheet with formula, change the sheet name/column names to suit your sheet i.e where you formulas are. Add more columns also.

    [VBA]Sub UpdateFormula()

    Sheets("Sheet1").Columns("A:A") _
    .TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
    FieldInfo:=Array(0, 1), TrailingMinusNumbers:=True

    Sheets("Sheet1").Columns("C:C") _
    .TextToColumns Destination:=Range("C1"), DataType:=xlFixedWidth, _
    FieldInfo:=Array(0, 1), TrailingMinusNumbers:=True

    End Sub[/VBA]

    hope this helps

  4. #4
    i attached a sample file


    if you will notice from the example there is a sheet 4 added which should have updated the "stat" sheet. what i need is to place a button on "stat" sheet with macro that everytime i add a new sheet, the formulas will update and give me the result once i hit the button.

  5. #5
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    Is this what you mean, i have attatched.

  6. #6
    thanks a lot georgiboy, this is what i needed....i just added the same code for column G

Posting Permissions

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