Thread: Stuck!
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Stuck!

Your problem statement leaves a lot of ambiguity, but perhaps you can
adapt this:
'


Public Sub CopyStuff()
Dim rCell As Range
Dim rDest As Range
Dim wsSheet As Worksheet
Dim dTest As Double

dTest = Worksheets("Sheet1").Range("A2").Value
Set rDest = Worksheets("Sheet1").Range("A5").Resize(, 25)
For Each wsSheet In Sheets(Array("Sheet2", "Sheet3", "Sheet5"))
With wsSheet
For Each rCell In .Range("A1:A" & _
.Range("A" & Rows.Count).End(xlUp).Row)
With rCell
If .Value = dTest Then
rDest.Value = _
.Offset(0, 1).Resize(, 25).Value
Set rDest = rDest.Offset(1, 0)
End If
End With
Next rCell
End With
Next wsSheet
End Sub

This copies rows from B* to Z* in sheets 2,3 and 5 for which the value
in A* equals the value in Sheet1, cell A2. It copies the values to
Sheet1, beginning at cell A5.



In article ,
"John" wrote:

I have what I would say is a easy problem to solve but I can't!. I want to
run a macro that will automatically 'copy paste special values' all cells in
a row between B* and Z* if the value in A* equates to a value in Cell A2.
This will be run over several worksheets



Any ideas?



Thanks