Hi I want to copy the data from one tab of the excel into another depending upon some conditions in the code but when I reun the subroutine it doesnt run I guess there is a mistake in the switch syntax
Sub Sort_tabs()
Dim fap As String, fo As String, one As String, two As String
Dim i As Integer, j As Integer, k As Integer, m As Integer, flag_core As Integer, flag_clear_cr As Integer
Dim flag_core_fap As Integer, flag_clear_cr_fap As Integer, flag_core_fo As Integer, flag_clear_cr_fo As Integer
Dim flag_core_one As Integer, flag_clear_cr_one As Integer, flag_core_two As Integer, flag_clear_cr_two As Integer
flag_core = 1
flag_clear_cr = 1
flag_core_fap = 1
flag_clear_cr_fap = 1
flag_core_fo = 1
flag_clear_cr_fo = 1
flag_core_one = 1
flag_clear_cr_one = 1
flag_core_two = 1
flag_clear_cr_two = 1
Dim customer_end As Long
fap = "Formal answer provided"
fo = "Follow up"
one = "1st line"
two = "2nd line"
Sheets("All").Activate
customer_end = find_low(2, 1) - cals a function
customer_end = customer_end - 1
For i = 1 To customer_end
Select Case Cells(2, 1) - This cell has string values
Case Is = "Core"
If Cells(2, i) = "Core" Then
If flag_clear_cr = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr = 0
End If
For j = 1 To 53
Sheet3.Cells(flag_core, j) = Sheet1.Cells(i, j).Value
Next j
flag_core = flag_core + 1
If Cells(i, 19) = fap Then
If flag_clear_cr_fap = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_fap = 0
End If
For j = 1 To 53
Sheet4.Cells(flag_core_fap, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_fap = flag_core_fap + 1
End If
If Cells(i, 19) = fo Then
If flag_clear_cr_fo = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_fo = 0
End If
For j = 1 To 53
Sheet5.Cells(flag_core_fo, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_fo = flag_core_fo + 1
End If
If flag_clear_cr_one = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_one = 0
End If
For j = 1 To 53
Sheet6.Cells(flag_core_one, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_one = flag_core_one + 1
If Cells(i, 15) = two Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_two = 0
End If
For j = 1 To 53
Sheet7.Cells(flag_core_two, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_two = flag_core_two + 1
End If
End Select
Next i
End Sub
Sub Sort_tabs()
Dim fap As String, fo As String, one As String, two As String
Dim i As Integer, j As Integer, k As Integer, m As Integer, flag_core As Integer, flag_clear_cr As Integer
Dim flag_core_fap As Integer, flag_clear_cr_fap As Integer, flag_core_fo As Integer, flag_clear_cr_fo As Integer
Dim flag_core_one As Integer, flag_clear_cr_one As Integer, flag_core_two As Integer, flag_clear_cr_two As Integer
flag_core = 1
flag_clear_cr = 1
flag_core_fap = 1
flag_clear_cr_fap = 1
flag_core_fo = 1
flag_clear_cr_fo = 1
flag_core_one = 1
flag_clear_cr_one = 1
flag_core_two = 1
flag_clear_cr_two = 1
Dim customer_end As Long
fap = "Formal answer provided"
fo = "Follow up"
one = "1st line"
two = "2nd line"
Sheets("All").Activate
customer_end = find_low(2, 1) - cals a function
customer_end = customer_end - 1
For i = 1 To customer_end
Select Case Cells(2, 1) - This cell has string values
Case Is = "Core"
If Cells(2, i) = "Core" Then
If flag_clear_cr = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr = 0
End If
For j = 1 To 53
Sheet3.Cells(flag_core, j) = Sheet1.Cells(i, j).Value
Next j
flag_core = flag_core + 1
If Cells(i, 19) = fap Then
If flag_clear_cr_fap = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_fap = 0
End If
For j = 1 To 53
Sheet4.Cells(flag_core_fap, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_fap = flag_core_fap + 1
End If
If Cells(i, 19) = fo Then
If flag_clear_cr_fo = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_fo = 0
End If
For j = 1 To 53
Sheet5.Cells(flag_core_fo, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_fo = flag_core_fo + 1
End If
If flag_clear_cr_one = 1 Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_one = 0
End If
For j = 1 To 53
Sheet6.Cells(flag_core_one, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_one = flag_core_one + 1
If Cells(i, 15) = two Then
For m = 2 To 10000
Cells(m, 53).Clear
Next m
flag_clear_cr_two = 0
End If
For j = 1 To 53
Sheet7.Cells(flag_core_two, j) = Sheet1.Cells(i, j).Value
Next j
flag_core_two = flag_core_two + 1
End If
End Select
Next i
End Sub