View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RyanH RyanH is offline
external usenet poster
 
Posts: 586
Default Event after update / calculation

Cool, so you have a Click event already. Just put this portion of code at
the end of your Calculator Code. Since you said you want the calculations to
go to different worksheets and cells you will have to change the Sheet Names
and Range Address to your specifications.

Application.ScreenUpdating = False

'puts results in specified cells
Sheet("Sheet1").Range("A1").Value = calculation1
Sheet("Sheet1").Range("A2").Value = calculation2
Sheet("Sheet1").Range("A3").Value = calculation3
Sheet("Sheet1").Range("A4").Value = calculation4
'etc.
End With

Application.ScreenUpdating = True


Hope this helps!
--
Cheers,
Ryan


"Troubled User" wrote:

RyanH,

Thanks for your reply. I am using the click event to determine what
information (column) to route to the calculator. I need to return the
information from the calculator without pressing a button or having the user
do anything else, it just needs to run after the calculate event so that I
get the results. If I put this in my click event, I get the results before
the calculations.

Thanks in advance.


"RyanH" wrote:

Since you posted this question in Excel Programming I am assuming you want
some VBA code. I'm not sure which event (if any) you use to apply the
calculation results to the worksheets. Do you have a Userform that does the
calculations? If not, I would just put a Command Button on a worksheet and
then assign this macro to it.

Private Sub CommandButton1_Click()

Application.ScreenUpdating = False

'puts results in specified cells
Sheet("Sheet1").Range("A1").Value = calculation1
Sheet("Sheet1").Range("A2").Value = calculation2
Sheet("Sheet1").Range("A3").Value = calculation3
Sheet("Sheet1").Range("A4").Value = calculation4
'etc.
End With

Application.ScreenUpdating = True

End Sub

Hope this helps!
--
Cheers,
Ryan


"Troubled User" wrote:

I have a spreadsheet with multiple sheets that run as a calculator.

I have an input sheet that routes a single column of information to the
calculator using a hlookup.

After you select a cell (column) the hlookup routes the information to the
calculator. At that point, after all the calculations are run I need copy
the information back from the calculator and store in the correct column.

I have tried using various events but everything returns the values prior to
selecting the particular column.

Any help is appreciated.