Solved

extract data from excel into vb

Posted on 2003-10-30
4
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: 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

This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.

734 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