I am getting close. After having more time and adjusting the current code I am using I am able to get it to work by changing that to a -6. I jsut cant figure out how to add a new section within. Each time I try I get error. I am missing either ) or " I think.
Sub addClassAll()
Dim sht As Worksheet
Dim Where As Range
For Each sht In Worksheets
With sht
Set Where = .Range("C" & .Rows.Count).End(xlUp)
Set Where = .Range("J1", .Range("J" & Where.Row))
End With
With sht.Range("J1")
.FormulaR1C1 = _
"=IF(LEFT(RC[-7],1)=""1"",""1 Sales"",IF(LEFT(RC[-7],1)=""3"",""5 Rest"",IF(LEFT(RC[-7],1)=""2"",""6 Institute"",IF(LEFT(RC[-7],1)=""4"",""1 Sales"", """"))))"
If Where.Rows.Count > 1 Then
.AutoFill Destination:=Where, Type:=xlFillDefault
End If
End With
Next
End Sub
I need to add this within the top code.
IF(LEFT(RC[-6],1)=""1"",""3 Class KKB""
Something is missing from the code below. I get an error each time
Sub addClassAll()
Dim sht As Worksheet
Dim Where As Range
For Each sht In Worksheets
With sht
Set Where = .Range("C" & .Rows.Count).End(xlUp)
Set Where = .Range("J1", .Range("J" & Where.Row))
End With
With sht.Range("J1")
.FormulaR1C1 = _
"=IF(LEFT(RC[-7],1)=""1"",""1 Sales"",IF(LEFT(RC[-7],1)=""3"",""5 Rest"",IF(LEFT(RC[-7],1)=""2"",""6 Institute"",IF(LEFT(RC[-6],1)=""1"",""3 Class KKB"",IF(LEFT(RC[-7],1)=""4"",""1 Sales"", """")))))"
If Where.Rows.Count > 1 Then
.AutoFill Destination:=Where, Type:=xlFillDefault
End If
End With
Next
End Sub