ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro (https://www.excelbanter.com/excel-programming/289182-macro.html)

C3

Macro
 
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!



Brad[_10_]

Macro
 
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
-----Original Message-----
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!


.



All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com