Hi All - I am a newbie at writing VBA. I have a set of data ranging thru columns A thru O. I am trying to add to new columns at the end titled GCP(Column P) and PLCC (Column Q).
Then I want to fill the two columns with these formulas.
ColumnP:=IF(ISERR(SEARCH("GCP",$D2,1))," ","GCP")
ColumnQ:=F2&P2
So far I have the coding below but isn't working properly. Can someone please assist? Thank you.
Sub CCFormat()
Columns("P:Q").Insert Shift:=xlToRight, _
CopyOrigin:=xlFormatFromLeftOrAbove 'or xlFormatFromRightOrBelow
Range("P2") = "=IF(ISERR(SEARCH("GCP",$D2,1))," ","GCP")": Range("P2:P" & LastRow).FillDown
Range("Q2") = "=F2&P2": Range("q2:P" & LastRow).FillDown
End Sub
Then I want to fill the two columns with these formulas.
ColumnP:=IF(ISERR(SEARCH("GCP",$D2,1))," ","GCP")
ColumnQ:=F2&P2
So far I have the coding below but isn't working properly. Can someone please assist? Thank you.
Sub CCFormat()
Columns("P:Q").Insert Shift:=xlToRight, _
CopyOrigin:=xlFormatFromLeftOrAbove 'or xlFormatFromRightOrBelow
Range("P2") = "=IF(ISERR(SEARCH("GCP",$D2,1))," ","GCP")": Range("P2:P" & LastRow).FillDown
Range("Q2") = "=F2&P2": Range("q2:P" & LastRow).FillDown
End Sub