|
-
Apr 3rd, 2005, 04:18 PM
#1
Thread Starter
Hyperactive Member
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
-
Apr 3rd, 2005, 05:17 PM
#2
Fanatic Member
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? 
-
Nov 6th, 2006, 04:00 AM
#3
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|