I am creating a package in SSIS which imports CSV files and dumps the data into a few tables. The files are initial csv reports run by the user and then saved to the folders that the package searches. The problem is that the csv files contain a field for the title which has the following string in the A column (range of A2 to the A64000):
How can I improve my macro to remove all information after the first hyphen. The worksheet may not always have the same name.
Code:
COLD NEWS-BBNW-09041 HEART OF THE CITY: DYING TO EAT
How can I improve my macro to remove all information after the first hyphen. The worksheet may not always have the same name.
Code:
Sub removeHyphen()
Dim lngIndex As Long
Dim strParts() As String
Dim strInput As String
Dim SearchRange As Range
Dim startRange As Range
Dim endRange As Range
startRange = "A2"
endRange = "A64000"
Dim Count
Dim myObj As Object
Set myObj = Sheets(1)
'Set SearchRange = ThisWorkbook.Worksheets").Range(startRange, endRange)
Set SearchRange = ThisWorkbook.Worksheets("01012010_03312010").Select
strParts = Split(strInput, "-")
strInput = ""
Count = 1
Do While Count < endRange.End(xlDown).Row
'For lngIndex = 0 To UBound(strParts) - 1
strInput = strInput & strParts(lngIndex) & "/"
' Next
strInput = Left(strInput, Len(strInput) - 1)
Loop
End Sub