If x = x then copy

Damianjay

New Member
Joined
Jun 3, 2011
Messages
5
Hello,
I'm trying to right a macro where IF user ID (column K in master sheet) = User ID (column B in Info Sheet) then Copy Cells C,D,E (From Infor Sheet) to Cells (N, O, P in Master Sheet)

Been pulling whats left of my hair out trying to do this

Please help
Thanks
Damian
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Code:
Sub PullingWhatsLeftOfMyHairOut()
    If Sheets("Master").Range("K1") = Sheets("Info").Range("B1") Then
        Sheets("Master").Range("C1:E1").Copy Sheets("Info").Range("N1")
    End If
End Sub
 
Upvote 0
Something like:
Code:
Sub UnicornsDontExit ()
 
Dim wm as Worksheet, wi as worksheet
Dim i as Long
 
Set wm = Sheets("Master")
Set wi = Sheets("Info")
 
With Application
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
End With
 
With wm
  For i = 1 to .Range("K" & Rows.Count).End(xlUp).Row
     If .Range("K" & i) = wi.Range("B" & i) Then .Range("N" & i & ":P" & i) = wi.Range("C" & i & ":E" & i)
  Next i
End With
 
With Application
    .ScreenUpdating = True
    .Calculation = xlCalculationAutomatic
End With
 
End Sub
 
Upvote 0
Maybe like this

Code:
Sub test()
Dim LR As Long, i As Long
With Sheets("Info")
    LR = .Range("B" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
        If .Range("B" & i).Value = Sheets("Master").Range("K" & i).Value Then
            .Range("C" & i).Resize(, 3).Copy Destination:=Sheets("Master").Range("N" & i)
        End If
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,500
Messages
6,125,168
Members
449,211
Latest member
ykrcory

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