Hi all, I am currently using the following vba code which I have assigned to a button which basically performs a vlookup between two workbooks but for columns S, T & U in the "SAS MI Extraction - TEST" workbook I want it so that it only affects blank cells. At the moment if there is any existing information in columns S, T & U the below code overrides what is in there. I don't want that to happen and to leave any existing text in the columns alone:
"Sub PerformChecks()
Dim w1 As Worksheet, wAs Worksheet
Dim c As Range, FR As Variant
Application.ScreenUpdatin False
Set w1 = Workbooks("SAS MI Extraction - TEST").Worksheets("SAS MI Data")
Set w2 = Workbooks("OIMDataRefresh_DMZ").Worksheets("OIMDataefresh_DMZ")
For EachIn w1.Range("R2", w1.Range("R" & Rows.Count).End(xlUp))
FR = Application.Match(c, w2.Columns("A"), 0)
If IsNeric(FR) Then w1.Range("S" & c.Row).Value = w2.Range("F" & FR).Value
If IsNumeric(FR) Then w1.Range("T" & c.Row).Value = w2.Range("H" & FR).Value
If IsNumeric(FR) Then w1.Range("U" & c.Row).Value = w2.Range(J" & FR).Value
Next c
Application.ScreenUpdating = True
End Sub"
"Sub PerformChecks()
Dim w1 As Worksheet, wAs Worksheet
Dim c As Range, FR As Variant
Application.ScreenUpdatin False
Set w1 = Workbooks("SAS MI Extraction - TEST").Worksheets("SAS MI Data")
Set w2 = Workbooks("OIMDataRefresh_DMZ").Worksheets("OIMDataefresh_DMZ")
For EachIn w1.Range("R2", w1.Range("R" & Rows.Count).End(xlUp))
FR = Application.Match(c, w2.Columns("A"), 0)
If IsNeric(FR) Then w1.Range("S" & c.Row).Value = w2.Range("F" & FR).Value
If IsNumeric(FR) Then w1.Range("T" & c.Row).Value = w2.Range("H" & FR).Value
If IsNumeric(FR) Then w1.Range("U" & c.Row).Value = w2.Range(J" & FR).Value
Next c
Application.ScreenUpdating = True
End Sub"