I am fairly new to VBA and I am working on having an xlookup function to return a certain value. I got the function working for the first cell, however when i try to autofill down it just autofills the result from the first cell down to the very last row. Down below is the code I currently have. I would want for each cell to have the formula all the way to the very last row of data.
Range("N1").Select
Selection.Value = "School By Email"
Dim usercw As Worksheet
Dim usercwe As Range
Dim usercws As Range
Set usercw = Sheets(1)
Set usercwe = usercw.Range("G:G")
Set usercws = usercw.Range("J:J")
Range("n2").Select
ActiveCell = Application.WorksheetFunction.XLookup(Range("C2"), usercwe, usercws)
The xlookup funct. is looking at another sheet in the very same Workbook and then returning a value from that very same sheet.
Bookmarks