I have the following macro that is supposed to generate specific data in column K if a cell in Column A contains a specific value. This does not complete successfully, and only seems to get to the point of creating the heading Custom Attribute 3, and saving the file as "Active-Transform.xls". The rest does not seem to occur. I did combine 2 separate macros, so perhaps the formatting or the way I did it is incorrect. I'm a novice. Below is the code. Thanks you in advance!
Private Sub Workbook_Open()
If ActiveSheet.Cells(1, 11) = "Custom Attribute 3" Then
'nothing to do as already done
'fill extra columns
'now save and close
Application.DisplayAlerts = False
Application.DisplayAlerts = True
Dim WS As Worksheet, I As Long, RwCnt As Long
Set WS = ActiveSheet
RwCnt = WS.Cells(Rows.Count, 1).End(xlUp).Row
WS.Cells(1, 11) = "Custom Attribute 3"
WS.Cells(1, 11).Font.Bold = True
For I = 2 To RwCnt
On Error Resume Next
If InStr(1, LCase(WS.Cells(I, 1)), "Fruit") Then
WS.Cells(I, 11) = "Apple"
If InStr(1, LCase(WS.Cells(I, 1)), "Vegetable") Then
WS.Cells(I, 11) = "Carrot"