Look up value based on one cell then write data to another sheet........

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
OK so I have many many scripts that do similar but i am drawing a blank on this one. What I am trying to do is:

A name will be in range c1 of sheet 1, I want to use that to find the matching name in sheet two then get the data from sheet one B40 and copy the data to sheet two column c of the row that contains the matching name. The names are in column A of sheet 2.

I know this is simple but I am just completely drawing a blank right now so any guidance to get me back on track is greatly appreciated.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi, an idea, adapt this for your project.
Book1
ABCD
1Sheet2This is sheet, from will I take the value in B1 (Sheet2!B1)
2
3InventoryThis cell show value taken from Sheet2!B1( in this case I have the word "Inventory" in this cell)
4
5
6
7OK so I have many many scripts that do similar but i am drawing a blank on this one. What I am trying to do is: A name will be in range c1 of sheet 1, I want to use that to find the matching name in sheet two then get the data from sheet one B40 and copy the data to sheet two column c of the row that contains the matching name. The names are in column A of sheet 2. I know this is simple but I am just completely drawing a blank right now so any guidance to get me back on track is greatly appreciated.
Sheet1
Cell Formulas
RangeFormula
C3C3=IFERROR(INDIRECT("'"&$C$1&"'!B"&1+A15),"")
 
Upvote 0
Maybe
VBA Code:
Sub cizzett()
    Dim Fnd As Range
    With Sheets("Sheet1")
        Set Fnd = Sheets("Sheet2").Range("A:A").Find(.Range("C1").Value, , , xlWhole, , , False, , False)
        If Not Fnd Is Nothing Then Fnd.Offset(, 2).Value = .Range("B40").Value
    End With
End Sub
 
Upvote 0
Maybe
VBA Code:
Sub cizzett()
    Dim Fnd As Range
    With Sheets("Sheet1")
        Set Fnd = Sheets("Sheet2").Range("A:A").Find(.Range("C1").Value, , , xlWhole, , , False, , False)
        If Not Fnd Is Nothing Then Fnd.Offset(, 2).Value = .Range("B40").Value
    End With
End Sub
Fluff, as always you are one insanely amazing genius.

This works perfectly and was easy to manipulate for a few other lines.

Thanks, already integrated.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,305
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top