Results 1 to 3 of 3

Thread: how to insert some rows to existing excel file?

  1. #1

    Thread Starter
    Hyperactive Member temp_12000's Avatar
    Join Date
    Jan 2004
    Location
    LA, USA
    Posts
    411

    Question how to insert some rows to existing excel file?

    I searched the forum, and only found some examples of creating new excel files. How can I insert some rows to existing excel file by using VB6?

    I have an excel file already which includes some sheets. In 2 sheets, I need insert some rows (with data in cells), so that the excel will compute some data based on the value in these cells.

    I need do this in VB6.


    thanks



  2. #2
    Fanatic Member doofusboy's Avatar
    Join Date
    Apr 2003
    Posts
    526

    Re: how to insert some rows to existing excel file?

    Just open the file as you normally would with VB and then do somthing like this:

    ' select the sheet where you want to insert rows
    Sheets("Sheet2").Select
    ' select the spot where you want to insert the row (3 are inserted here)
    Range("A2:A4").Select
    ' insert the rows
    Selection.EntireRow.Insert

    Then just do a normal file read to get your data and add it to the rows/cells you just inserted.

    Range("A2").Value = data from your file
    Range("A3").Value = data from your file
    Range("A4").Value = data from your file
    Do canibals not eat clowns because they taste funny?

  3. #3
    Junior Member
    Join Date
    Mar 2005
    Posts
    18

    Re: how to insert some rows to existing excel file?

    Can you please let me know how I could open an excel file and then do the insert. I am a beginner, please give me an example which will help me do that. I have a file and would like to insert some rows after every line.

    Please help me asap!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width