Posted to microsoft.public.excel.programming
|
|
finding a cell
Hi
see:
http://www.rondebruin.nl/copy5.htm
-----Original Message-----
I have a range of cells (codes) in column h which is
dynamic.
I need to cycle through these cells and for each of them
find a
corresponding cell (or code) in a different workbook.
I then need to copy the row based on that cell (code)
from that
workbook back to another sheet in the first and paste it
right at the
bottom.
I think I probably need a With every statement or a loop -
but I am not
sure how to start.
Sub FindCode()
FName = ActiveWorkbook.Name 'Save active workbook
file name to
variable FName
FPath = ActiveWorkbook.Path 'Save active workbook
path to
variable FPath
' With Worksheets(1).Range("NoBlanksRange")
' Set c = .Find(2, LookIn:=xlValues)
' ActiveCell.Select
' Application.CutCopyMode = False
CC = ActiveCell.Copy
Windows("Source.xls").Activate
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Find(What:="CC", After:=ActiveCell,
LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Rows("1:1").EntireRow.Select
'Application.CutCopyMode = False
Selection.Copy
Windows(FName).Activate
Sheets("Data").Select
Range("a2").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(-1, 0).Range("A1").Activate
'ActiveSheet.Paste
End Sub
--
rbekka33
----------------------------------------------------------
--------------
rbekka33's Profile: http://www.excelforum.com/member.php?
action=getinfo&userid=14033
View this thread:
http://www.excelforum.com/showthread...hreadid=262713
.
|