+ Reply to Thread
Results 1 to 5 of 5

Triggering value change in vba output on sheet two when input comes from sheet one

Hybrid View

heidenman Triggering value change in... 07-31-2009, 04:06 AM
PetrH Re: Triggering value change... 07-31-2009, 04:16 AM
heidenman Re: Triggering value change... 07-31-2009, 04:51 AM
Phil_V Re: Triggering value change... 07-31-2009, 05:41 AM
heidenman Re: Triggering value change... 07-31-2009, 02:03 PM
  1. #1
    Registered User
    Join Date
    07-24-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    8

    Triggering value change in vba output on sheet two when input comes from sheet one

    Hi,

    I have a bit of code in sheet two of my document that requires user input to produce output. However I have the document set up in a vway that requires the actual input to be placed in a vell in sheet one, and the cell in sheet two is just "=cell in sheet one".

    This causes the input cell in sheet two to change but the output cell does not produce the new answer.

    Anyone know why?

    Thanks in advance!
    Last edited by heidenman; 07-31-2009 at 02:05 PM.

  2. #2
    Registered User
    Join Date
    01-22-2009
    Location
    Brno, Czech Republic
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Triggering value change in vba output on sheet two when input comes from sheet on

    Hallo,
    does the recalculation (F9) help? The original file would be helpful to understand you. Can you attach it?
    Regards
    Petr

  3. #3
    Registered User
    Join Date
    07-24-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Triggering value change in vba output on sheet two when input comes from sheet on

    Sheet 2 E2 changes on the basis of what is given in E1. However only when input is given manually it seems, and this is my problem.

    I need Sheet 2 E1 to pick up input from sheet 1 F13 and then E2 to change.

    This in turn gives the ouptut back to a calculation in sheet 1 F14.

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Triggering value change in vba output on sheet two when input comes from sheet on

    When the value changes on Ark2 it is changing as the result of a 'Calculate' not a 'Change', so you would need to use the Worksheet_Calculate event of Ark2, and adapt your code to fit it, as per below. This goes into the Ark2 sheet code:
    Private Sub Worksheet_Calculate()
    Const IN_CELL As String = "E1"
    Const OUT_CELL As String = "E2"
    
    With Me ' the sheet that called the 'Calculate' event
        .AutoFilterMode = False ' Remove any old filter
        .Cells(1, 1).AutoFilter field:=1, Criteria1:=.Range(IN_CELL).Value ' filter on the INPUT cell
        Application.EnableEvents = False
        ' Set the output cell to the minimum price
        .Range(OUT_CELL).Value = WorksheetFunction.Min(.AutoFilter.Range.Cells.SpecialCells(xlCellTypeVisible))
        Application.EnableEvents = True
        .AutoFilterMode = False ' Remove the filter again
    End With
    End Sub
    Incidently, E1 on the Ark2 sheet could have this forumla:
    =CONCATENATE(Ark1!E13," ",Ark1!F13)
    Then you wouldn't need the 'helper' cell in column G of Ark1 (and therefore wouldn't need to hide that column )
    Last edited by Phil_V; 07-31-2009 at 05:45 AM. Reason: E1 formula change
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  5. #5
    Registered User
    Join Date
    07-24-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Triggering value change in vba output on sheet two when input comes from sheet on

    Works perfectly...

    I am bowing in awe and respect.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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