We help IT Professionals succeed at work.
Get Started

VB6 copy from excel spreadsheet into another spreadseet

602 Views
Last Modified: 2012-05-09
What is the best way to do this?  

I have 2 Excel spreadsheets.  I need to read a value from the column of one spreadsheet, count the number of successive rows that value is found in same column, find that value in the same column in another spreadsheet, then insert the rows of data into spreadsheet 2, based on the number of rows read from the first spreadsheet.

Example.  Based on the following spreadsheet1, I need to read the loom no. in column A (loom no 7).  Based on the number of rows that loom no. 7 appears in spreadsheet1, I want to insert rows (2 in this case) into spreadsheet2 after the last row for loom number 7 (row 40) into spreadsheet 2.

ie, For loom no. 7, I will insert 2 rows into spreadhheet 2 after row 40, then insert the data from spreadsheet1 into those rows.

I will do this again for the next loom number, 21, in spreadsheet 1.

Spreadsheet1: Source
====================

    A                B                  C                         D
::::::::::::::::
1: loomNo
2: ______
3:  7               x                   x                         x
4:  7              x2                  x2                      x2
5:  21            x3                  x3                      x3
6:  21            x4                  x4                      x4
7:  21            x5                  x5                      x5

Spreadsheet: Destination
====================
    A                B                  C                         D
::::::::::::::::
1: loomNo
2: ______
40: 7
41: 21
42: 21
43: 6
44: 6
Comment
Watch Question
Owner (Aidellio)
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE