I have the following code...I'd like to enhance it to include the use of Wildcards, but am having some troubles - any help would be appreciated!
Option Explicit
Sub final_data()
Dim lrow As Long, i As Long, j As Long, lastrow As Long, x As Long, counter As Long
With Worksheets("RawData")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
For j = 10 To 14
If .Cells(i, j).Value = "Not Sourced" Then
.Range("A" & i & ":I" & i).Copy Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
lastrow = Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("FinalData").Cells(lastrow, j).Value = "Not Sourced"
End If
Next j
Next i
Worksheets("FinalData").Columns("J:N").HorizontalAlignment = xlCenter
End With
End Sub
I'd like to change the "Not Sourced" to be "* - Not Sourced" as I have three different versions "D - Not Sourced", "P - Not Sourced", and "W - Not Sourced". I have tried using Like, but in the second instance of "Not Sourced", it throws a syntax error.
Option Explicit
Sub final_data()
Dim lrow As Long, i As Long, j As Long, lastrow As Long, x As Long, counter As Long
With Worksheets("RawData")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
For j = 10 To 14
If .Cells(i, j).Value = "Not Sourced" Then
.Range("A" & i & ":I" & i).Copy Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
lastrow = Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("FinalData").Cells(lastrow, j).Value = "Not Sourced"
End If
Next j
Next i
Worksheets("FinalData").Columns("J:N").HorizontalAlignment = xlCenter
End With
End Sub
I'd like to change the "Not Sourced" to be "* - Not Sourced" as I have three different versions "D - Not Sourced", "P - Not Sourced", and "W - Not Sourced". I have tried using Like, but in the second instance of "Not Sourced", it throws a syntax error.