Solved

extract data from excel into vb

Posted on 2003-10-30
4
164 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
This is an explanation of a simple data model to help parse a JSON feed
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now