The revolutionary project management tool is here! Plan visually with a single glance and make sure your projects get done.
Sub MyLookup()
Dim lRow As Long
lRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
With Sheets("Sheet1")
.Range("B2:B" & lRow) = Application.WorksheetFunction.VLookup(.Range("A2:A" & lRow), Sheets("Sheet2").Range("A:B"), 2, 0)
End With
End Sub
Example.xls
Sun ApplyNames()
Dim rngID As Range, rngLookup As Range
'assume Sheet1 holds the 500 IDs and blank name column
'assume Sheet2 range A2:B11 holds your unique IDs and the Names you want to apply to Sheet1
With Sheets("Sheet1")
Set rngID = .Range("A2:A" & .Cells(.Rows.Count,"A").End(xlUp).Row) 'assume header in row 1
End With
Set rngLookup = Sheets("Sheet2").Range("A2:B11") 'amend as appropriate
'now apply names using Vlookup function of the WorksheetFunction object:
rngID.Offset(0,1).Value = Application.Vlookup(rngID,rngLookup,2,False)
End Sub
Sub test1()
Dim n As Long
For n = 1 To Range("A1:AB5000").Count
Range("A1:AB5000").Cells(n).Value = 1
Next n
End Sub
Sub test2()
Range("A1:AB5000").Value = 1
End Sub
Sub test1()
Dim n As Long
With Sheets("Sheet1")
For n = 1 To 5000
.Cells(n, 1) = 1
Next n
End With
End Sub
Sub test1()
Dim n As Long
For n = 1 To Range("A1:AB1000").Count
Range("A1:AB1000").Cells(n) = "=5+2"
Next n
End Sub
Sub test2()
Range("A1:AB50000") = "=5+1"
End Sub
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.