So I have a macro that imports data (responses from a survey in French and English) from two closed workbooks into sheets 1 and 2 (named "English" and "French", respectively).
I then have a second macro that splits the timestamp (column A) into two columns to separate the date from the time.
It then checks column 6 (F) to see if it is "Abandoned" and deletes that row.
It then adds a formula in T3 and U3 and autofills dynamically to the end of the column
Right now this macro only runs on the first sheet. I want it to run on the first and second sheet. I would appreciate any optimizations as well as it is a mish-mash of code I found searching forums.
I then have a second macro that splits the timestamp (column A) into two columns to separate the date from the time.
It then checks column 6 (F) to see if it is "Abandoned" and deletes that row.
It then adds a formula in T3 and U3 and autofills dynamically to the end of the column
Right now this macro only runs on the first sheet. I want it to run on the first and second sheet. I would appreciate any optimizations as well as it is a mish-mash of code I found searching forums.
Code:
Sub SplitDate()
'
' Splits Date & Time into two columns
'
Columns("B:B").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A:A").TextToColumns Destination:=Range("A:A"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
'Deletes responses abandoned on first question
Dim LastRow As Long
LastRow = [A65536].End(xlUp).Row
For i = LastRow To 1 Step -1
If Cells(i, 6) = "Abandoned" Then Rows(i & ":" & i).EntireRow.Delete
Application.ScreenUpdating = False
Next i
'' Adds Promoters,Detractors, etc to columns t/u
Dim endrow As Long
endrow = Sheets("English").UsedRange.SpecialCells(xlCellTypeLastCell).Row
Range("T3").FormulaR1C1 = _
"=IF(RC[-13]=""Unattempted"",""N/A"",IF(RC[-13]=""Abandoned"",""N/a"",IF(RC[-13]>8,""Promoter"",IF(RC[-13]>6,""Passive"",""Detractor""))))"
Range("T3").AutoFill Destination:=Sheets("English").Range("T3:T" & endrow), Type:=xlFillDefault
Range("U3").FormulaR1C1 = _
"=IF(RC[-10]=""Unattempted"",""N/A"",IF(RC[-10]=""Abandoned"",""N/a"",IF(RC[-10]>8,""Promoter"",IF(RC[-10]>6,""Passive"",""Detractor""))))"
Range("U3").AutoFill Destination:=Sheets("English").Range("U3:U" & endrow), Type:=xlFillDefault
End Sub