Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default PAssing Values to Excel

Private Sub cmdCalc_Click()
' check values are inputted
If txtIK1.Text = "" Then
MsgBox "Input Weekly Hour Rate "
Exit Sub
End If
If txtIK2.Text = "" Then
MsgBox "Input Weekly Hours"
Exit Sub
End If

txtIK3.Text = Multiply(txtIK1.Text, txtIK2.Text)
txtIK4.Text = Multiply(txtIK3.Text, 52)

End Sub

I use above to calculate values, then the SUB MAinExcelApp does its stuff.
i.e. open excel app, create worksheet then poulate the rows and headers. FIne
so far. I wish to achieve by running cmdCalc again another calculation, then
pass the values into the"open worksheet" in rows below the "previous
calculation" Hope this makes sense to you..

Kevan

"Bob Phillips" wrote:

Don't declare xlApp as a New Excel.Application , just Excel.Application.
Then use GetObject to see if it is running, and CreateObject if it is not.

Not really sure what you mean by point 2, but .Offset(1,0) takes you 1 row
down.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kevan Hughes" wrote in message
...
I have created VB6 program and have used the following :
Sub MainExcelApp()
Dim xclApp As New Excel.Application
Dim xclWorkbook As Excel.Workbook
Dim xclSheetA As Excel.Worksheet
Dim xclRangeA As Excel.Range
Dim rng As Excel.Range
' Create the workbook and add a sheet
Set xclWorkbook = xclApp.Workbooks.ADD
Set xclSheetA = xclWorkbook.Worksheets(1)

xclSheetA.Activate
' Name the sheet
xclSheetA.Name = frmSjukMain.Caption
' Create the header row
Set xclRangeA = xclSheetA.Range(xclSheetA.Cells(5, 2),
xclSheetA.Cells(5, 7))
Set xclRangeA = xclSheetA.Range(xclSheetA.Cells(6, 2),
xclSheetA.Cells(6, 7))
Set xclRangeA = xclSheetA.Range(xclSheetA.Cells(10, 2),
xclSheetA.Cells(10, 7))

This is an excerpt of course. You can see I have a header column and then
below it values being passed from a MDI form in my program. Final cell

range
is for a formula ( further down my coding..It works ) I would like to be

able
to achieve 2 things.

1. Detect that Excel is open, which it is after running the first instance
and passed it values. I have verified it is still open.

2. Allow me to pass another calculation totals, using different values

from
the same MDI form, and passing these into the "active sheet" from 1st
calculation, BUT in the columns&rows directly below 1st calculation. That

is
why i have an addition formula situated several rows below 1st calc. To

ADD
my Total costs..

I hope this is understandable to what I am trying to achieve

thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing Excel system values (constant) of properties as arguments Roland Excel Programming 3 January 14th 05 10:06 PM
Excel VBA - Problem calculating and passing values to another worksheet DanielCox Excel Programming 1 August 31st 04 12:36 PM
Passing values to new app BrianG[_4_] Excel Programming 3 May 27th 04 01:58 PM
Passing Values Syntax Chuck Taylor Excel Programming 3 January 12th 04 04:38 PM
Passing values between 2 subs ? [email protected] Excel Programming 1 November 21st 03 05:56 PM


All times are GMT +1. The time now is 06:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"