In the previous example, you could use
oWS.Cells(mRow, 2).Value = 23.5
oWS.Cells(mRow, 3).Value = 17.6
oWS.Cells(mRow, 4).Value = 19
where mRow is a variable in the module, and the 2, 3, and 4 are column
numbers (i.e. B, C, and D).
So, you could start with mRow = 1, then increment it each time the
procedure is called.
"terry.wright" <te***@wrico.karoo.co.uk> wrote in message
news:Rt********************@karoo.co.uk...
Hi
I have p[icked up this thread and have a student who is trying to
enter data to Excel from a VB form and this works a treat. Is there any way to
get the system to enter each instance into successive rows in the spreadsheet.
e.g. first use enters to B1,C1,D1 and the next to B2,C2,D2 etc. etc.
Regards
Terry
"Steve Gerrard" <no*************@comcast.net> wrote in message
news:Ib********************@comcast.com...
"JW" <j@hetnet.nl> wrote in message
news:c1**********@reader08.wxs.nl... I am looking for sample code to learn me about using excel from a
visual basic program.
I want to open a file, store code in a certain cell and save this
again.
Who can help me
Regards
This example shows the basic operations.
Set a reference in you VB project to the Microsoft Excel Object
Library.
Private Sub Command1_Click()
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet
Set oXL = New Excel.Application
Set oWB = oXL.Workbooks.Open("C:\Documents\MyFile.xls")
Set oWS = oWB.Worksheets("Sheet1")
oWS.Range("B1").Value = 23.5
oWS.Range("B2").Value = 17.6
oWS.Range("B3").Formula = "=B1+B2"
oWB.Save
oXL.Quit
End Sub