Solved

extract data from excel into vb

Posted on 2003-10-30
4
167 Views
Last Modified: 2010-05-18
Hi,
Can anyone of you experts show me example of coding that extract data in the excel into vb?

I have this excel file that contain few columns (assume to be 3 columns) and rows (assume 10 rows)
I want to extract data in the SECOND column but start at Third row and put the data into a formula that i already write the code in vb. The process repeat for the next row with the same column until it reach the last row ( 10th row). When it reach there, a msgbox will popup.
Also when all this finish, the excel file will close itself and save itself into hard disk (if file already exist, overwrite it).

i think this is simple to you guys. i'm very new to vb (actually never use or learn vb before). So need your help very much. Sound desperate huh!? :)
0
Comment
Question by:michelle_branch
4 Comments
 
LVL 9

Accepted Solution

by:
bhagyesht earned 45 total points
ID: 9656119
take a form
add microsoft excel's reference.
add a command button and the following code
this will help you start with.

Private Sub Command1_Click()
    Dim myapp As New Excel.Application
    Dim myWB As Excel.Workbook
    Dim myWS As Excel.Worksheet
    Set myWB = myapp.Workbooks.Open("c:\myfile.xls")
    myapp.Visible = True
    Set myWS = myWB.Sheets("sheet1")
    MsgBox myWS.Range("A1").Value
    myWB.Save
    Set myWS = Nothing
    myWB.Close
    Set myWB = Nothing
    myapp.Quit
    Set myapp = Nothing
End Sub
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Recommendation vb6 to vb.net or others 14 200
ejb wildfly example 2 69
SQL Insert parts by customer 12 51
add projects t working set in maven 2 37
A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question