Hey there, try this code out just paste it into a new module(in VBE) in
the workbook.
Make sure to read the comments in the code to change the ranges and the
names of the worksheets:
Sub CopyPaste()
Dim mCell, MyRange, MyCopy As Range
Dim Ws1, Ws2 As Worksheet
'Make sure you set your worksheets
'Ws1 is where your info is
'Ws2 is where you wnt the info to go
'MyRange is obviously your data range in
'Ws1
Set Ws1 = Worksheets("Sheet1")
Set Ws2 = Worksheets("Sheet2")
Set MyRange = Ws1.Range("A1:A16")
For Each mCell In MyRange
If IsNumeric(mCell) And Not _
IsNumeric(mCell.Offset(0, 1).Value) Then
Range(mCell.Offset(1, 0), mCell.Offset(1, 3)).Copy
With Ws2
.Activate
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 1).Select
End With
Selection.Offset(0, -1).Value = mCell.Value
Selection.PasteSpecial xlPasteAll
End If
Next
End Sub
Sandy
wrote:
Hi,
I have a report which I was able to parse data out of however the
format changed (rendering the programming useless) and I'm looking for
a better solution.
What I need to do is find a 3 digit number (not within another number,
very important) from within a range and then copy/paste information
from the cell below it and the 3 cells to the right of that one to a
range in another part of the spreadsheet. Based on the data below this
is what I would be looking for...
Find the number "101" (see exhibit "A") and then copy 74,980, 0,
22,100.00 and 52,880 to a range in another part of the same spreadsheet
(see exhibit "B").
The same process would continue for number 102, 103, 104, etc.
Exhibit A
101 Mark K Brar
74,980.00 0 22,100.00 52,880.00
102 Mark K Brar
20,580.00 18,000.00 2,070.00 36,510.00
103 Mark K Brar
3,260.63 0 0 3,260.63
104 Mark K Brar
7,759.24 4,064.00 2,105.40 9,717.84
105 Lucy Davenport 10/12/2006
9,839.04 0 0 9,839.04
106 Rebecca Smith 10/12/2006
6,855.24 5,447.00 3,401.57 8,900.67
107 Mark K Brar
3,213.70 0 3,213.70
108 Ralph Jones 8/24/2005
0 0 0 0
Exhibit B:
101 $74,980.00 $0.00 $22,100.00 $52,880.00
102 $20,580.00 $18,000.00 $2,070.00 $36,510.00
103 $3,260.63 $0.00 $0.00 $3,260.63
104 $7,759.24 $4,064.00 $2,105.40 $9,717.84
105 $9,839.04 $0.00 $0.00 $9,839.04
106 $6,855.24 $5,447.00 $3,401.57 $8,900.67
107 $3,213.70 $0.00 $0.00 $3,213.70
108 $0.00 $0.00 $0.00 $0.00