Reputation: 41
I am trying to copy The value from a formula in cell R15 on sheet3 into a specific cell on a specific line on Sheet6. The specific line is determined by the data entered into cell O15 on sheet3 matching the data on the specific line on sheet6. I have managed to work out how to locate the correct line on sheet6 with the following code
Sheets("Sheet6").Range("C310").Value = WorksheetFunction.Match(Sheets("Sheet3").Range("O15").Value, Sheets("sheet3").Range("C1:C300"), 0)
The code above returns the correct line number in cell C310, I just haven't worked out how to use this information to be able to copy the data from Cell R15 onto a cell along the row shown by the result of the above code in C310 above.
I have tried searching online, but I think I am probably typing the wrong question to return the answer I am looking for.
Could someone please point me in the right direction, so I can get the information copied over to the correct cell, once the matching process has been performed.
Upvotes: 0
Views: 63
Reputation: 926
Just add this line of code after these you posted:
Sheets("Sheet6").Cells(Sheets("Sheet6").Range("C310"), i) = Sheets("Sheet3").Range("R15")
and replace i with the corresponding number of the desired column. (eg. 5 is for column E)
Upvotes: 1
Reputation: 11
You can do like this
x = WorksheetFunction.Match(Sheets("Sheet3").Range("O15").Value,Sheets("sheet3").Range("C1:C300"), 0)
Sheets("Sheet3").Range("D" & x).Value = x
replace Sheets("Sheet3").Range("D" & x) with desired sheet and range
Upvotes: 0