Macro

  • Thread starter Thread starter C3
  • Start date Start date
C

C3

Hi!

How to make a macro who will in a first worksheet copy a cell (etc. five
digit number) then in second worksheet will find a content of a cell with
that number, select a whole row with that number then go back in a first
worksheet and paste it.
That must work for each time with a different number.
I was trying do this, but macro recorded content of that cell and every time
when it goes to a search, he searches the same number who is recorded in a
first time.

Thanx!
 
Here is a procedure that will do what I understood you to
mean. You said macro, so I assume you mean you only have
one target, and you want it pasted right over what you
typed. Try to be a little more specific with your data
and your requirements.

Sub CopyRow()
Dim rngTarget As Range
Set rngTarget = Worksheets("Sheet1").Range("A2")

Dim rngCopy As Range
Set rngCopy = Worksheets("Sheet2").UsedRange.Find
(rngTarget.Value, , xlValues, xlWhole).EntireRow

rngCopy.Copy
rngTarget.PasteSpecial xlPasteAll
End Sub

HTH.
-Brad
 
Back
Top