View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
DMoney DMoney is offline
external usenet poster
 
Posts: 130
Default Lookin cell values, copy a range and paste it

This should do it -- u may need to adjust the value of i to get the 276 line
criteria correct


Sub tst()
Dim i As Integer
Dim j As Integer
Dim a As String
Dim b As String
Dim c As String
i = 276
j = 0
Range("A1").Select
Do Until ActiveCell.Address = "$A$65536"
If Left(ActiveCell.Value, 7) = "perform" Then
j = j + 1
a = ActiveCell.Address
ActiveCell.Offset(i, 0).Activate
b = ActiveCell.Address
c = a & ":" & b
Range(c).Copy
Range(a).Select
ActiveCell.Offset(0, j).PasteSpecial
ActiveCell.Offset(1, -j).Activate
Else: ActiveCell.Offset(1, 0).Activate
End If
Loop
Range("A1").Select
End Sub

" wrote:

HI again group,

I am almost breaking my head to successfully write a macro for what I
am trying to accomplish...

1. Look in range A1:A65536.
2. IF any cell value in range A1:A65536 starts with the word
"perform", THEN FIND that cell and copy it and the next 276 values and
paste in the adjacent columns..

Example:
Assuming cell A6 has the word "performance 1", cell A400 has the word
"performance 2" and cell A878 has the word "perform23", then, copy
cells A6 thru A281 (interval - 276) and paste in cell B1.
Copy cell A400 thru A675 (interval - 276) and paste in cell C1.
Copy cell 878 thru 1153 (interval - 276) and paste in cell D1.
etc...

Any help would be greatly helpful.. I am really blowing my mind here
to get this working.

Kevin