Finding and copying from data file

jpen

Active Member
Joined
Jun 19, 2002
Messages
401
Hi all,

I want to copy data from a data file to another file.

First I have to find the name in the data file (QQQQ, XXXX, YYYY) and then copy the data above the name. See example.
CLIPBORD.xls
ABCD
11a1355.50%
2a2181.50%
32b1538.70%
4b2296.20%
5b3584.90%
6b4378.70%
7b5270.50%
83c1687.30%
9c2687.90%
10c3386.80%
11----------
12AverageQQQQ3.469.60%
13
141a1191.10%
15----------
16AverageXXXX191.10%
17
181a1550.00%
19a20.0!
20a3590.00%
21a4333.30%
222b1383.30%
23b2383.30%
243c1560.00%
25c2641.70%
26c3633.30%
274d15100.00%
28d2366.70%
29----------
30AverageYYYY3.8!69.20%
CLIPBORD


For QQQQ there are 10 rows of data.
For XXXX there are 1 rows of data.
For YYYY there are 11 rows of data.

These data I want to copy to the other file where I have worksheets called QQQQ, XXXX and YYYY.

Has anyone a idea how to solve this problem.


JH
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
hi -
try this one.
data in first sheet, other sheets QQQQ,XXXX,YYYY to the right

Code:
Sub sample()
On Error Resume Next
Dim a
Dim i, ii As Long
ii = Sheets(1).Range("b" & Rows.Count).End(xlUp).Row
For i = 2 To Sheets.Count
    With Sheets(1).Range("b1:b" & ii)
        Set c = .Find(Sheets(i).Name, , , xlWhole)
            If Not c Is Nothing Then
                a = c.Offset(, 1).End(xlUp).Row
                    Range("a" & a & ":d" & c.Row).Copy Sheets(i).Range("a" & Rows.Count).End(xlUp).Offset(1)
            End If
    End With
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,822
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top