In my excel, C column always will have text either response
or resolution
. My goal is to separate A:C columns based on this. If C column has text response
, Copy A:C column to E:G
otherwise copy A:C
to I:K
I am using below code now:
Sub SLACalc()
Dim DTA As Workbook
Dim SLADATA As Worksheet
Set DTA = Excel.Workbooks("main.xlsm")
Set SLADATA = DTA.Worksheets("SLA DATA")
For i = 2 To SLADATA.Cells(Rows.Count, "A").End(xlUp).Row
If InStr(Cells(i, "C").Value, "response") > 0 Then
SLADATA.Cells(i, "E").Value = SLADATA.Cells(i, "A").Value
SLADATA.Cells(i, "F").Value = SLADATA.Cells(i, "B").Value
SLADATA.Cells(i, "G").Value = SLADATA.Cells(i, "C").Value
Else
SLADATA.Cells(i, "I").Value = SLADATA.Cells(i, "A").Value
SLADATA.Cells(i, "J").Value = SLADATA.Cells(i, "B").Value
SLADATA.Cells(i, "K").Value = SLADATA.Cells(i, "C").Value
End If
Next i
End Sub
This is working fine when I have less row in A:C
. Now I have rows close to 20,000 and facing lot performance issues with excel. Is there anyway I can improve code to run it faster.