View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Coping info inside cells

Look at the following macro:

Sub copy_it()
Dim r As Range, r1 As Range, r2 As Range
Workbooks("Book1").Activate
Worksheets("Sheet1").Activate
s = InputBox("Enter search value: ")
For Each r In ActiveSheet.UsedRange
If r.Value = s Then
Set r1 = Range(r, r.Offset(0, 8))
Set r2 = Workbooks("Book2").Worksheets("Sheet1").Range("A1" )
r1.Copy r2
Exit Sub
End If
Next
End Sub

It examines all the cells in workbook Book1, worksheet Sheet1 for a value.
If that value is found, then that cell and the eight cells next to it are
copied to workbook Book2.
--
Gary's Student


"Hinojosa" wrote:

I'm trying to get the information inside of the cells to copy to another
workbook no matter where the info is.
I have tried to the find command and that works but i need the name plus the
numbers in the next 8 cells to the right to move too and those numbers are
always changing. Is there a way to find a certain name and always have the 8
cells next to the name move?