Hi all
I am using Access to open a csv file and then populate a table with the data. This works fine with no problems.
However, in order to do this efficiently I have had to modify the csv file to remove the last 5 lines that the crm package has added to the file.
I have a excel macro that will remove the last five lines once it has found the word it is looking for. However if the macro doesn't find the word i need it to stop and close the file.
Here is the excel macro im using.
I am using Access to open a csv file and then populate a table with the data. This works fine with no problems.
However, in order to do this efficiently I have had to modify the csv file to remove the last 5 lines that the crm package has added to the file.
I have a excel macro that will remove the last five lines once it has found the word it is looking for. However if the macro doesn't find the word i need it to stop and close the file.
Here is the excel macro im using.
Function LastRow()
If WorksheetFunction.CountA(Cells) > 0 Then
LastRow = Cells.Find(What:="some name etc", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
End If
End Function
Sub DeleteRows()
Rows(LastRow - 4 & ":" & LastRow).Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub