I have two sheets in a workbook. One contains a form, and the other contains data to populate the form with. I was able to write a small macro which successfully loops and populates the cell, Job Title, in Range("B16:I16") with the information in Column A from Data.
I'm trying to write an If statement within VBA that would populate the cell, Employee Work Location (Building), in Range("D14:H14") depending on the text in Job Title.
I wrote something out, but it doesn't seem to work. I get a mismatch error. May I ask for help with this please?
Thank you!
Sub FormPopulate_Click()
Dim i As Integer
Dim Building_Location as String
For i = 2 To 3
Sheets("Data").Select
Range("A" & CStr(i)).Select
ThisFile = Range("A" & CStr(i))
Selection.Copy
Sheets("Form").Select
Range("B16:I16").Select
ActiveSheet.Paste
Sheets("Form").Select
If Worksheets("Form").Range("B16:I16") = "Coordinator" Then
Building_Location = "East Quad"
Else
Building_Location =""
End If
Sheets("Form").Range("D14:H14").Value = Building_Location
Next i
End Sub