Updated Value from 1 Sheet to another

smartguy

Well-known Member
Joined
Jul 14, 2009
Messages
778
Hello all,

I have excel in the below format.


Excel 2013/2016
ABCD
1Asset tagCIIM Asset IDStatusValue
2E2902202118195Yes123
3E2900852118571Yes345
4E2913082119523Yes12
5E4524042128911Yes12
Sheet1



In Sheet 2 I need to update value.


Excel 2013/2016
ABCD
1Asset tagCIIM Asset IDStatusValue
2E2913082118195
3E4524042118571
Sheet2


Answer :


Excel 2013/2016
ABCD
1Asset tagCIIM Asset IDStatusValue
2E2913082118195Yes123
3E4524042118571Yes345
Sheet2


Please help me to provide VBA Code.

Regards,
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try:
Code:
Sub UpdateData()
    Application.ScreenUpdating = False
    Dim LastRow As Long, desWS As Worksheet, srcWS As Worksheet, fnd As Range, ID As Range
    Set desWS = Sheets("Sheet2")
    Set srcWS = Sheets("Sheet1")
    LastRow = desWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each ID In desWS.Range("B2:B" & LastRow)
        Set fnd = srcWS.Range("B:B").Find(ID, LookIn:=xlValues, lookat:=xlWhole)
        If Not fnd Is Nothing Then
            fnd.Offset(0, 1).Resize(, 2).Copy ID.Offset(0, 1)
        End If
    Next ID
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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