I have a csv file created from an enterprise program (P6).
If I "query" the csv file from an excel workbook, the data will not come over due to the way the csv file is. It has hard returns and the Program (P6) input certain text and calculations, so when either "queried" or "imported" (delimited) the csv file data does not come in at all or is offset to corrupt the data per column.
The code I have copies the range of used data and places it in the sheet I need it in.
Can this code be cleaned up so it does not "select" as much, or even get the data without opening the WB?
If I copy the sheet I would need to rename the "code" name of the imported sheet as other sheets use the code name in subroutines.
Would it be worth writing code to save the csv file as an xls and then delete a column not needed (causing the problem)?
Thanks, Chas
If I "query" the csv file from an excel workbook, the data will not come over due to the way the csv file is. It has hard returns and the Program (P6) input certain text and calculations, so when either "queried" or "imported" (delimited) the csv file data does not come in at all or is offset to corrupt the data per column.
The code I have copies the range of used data and places it in the sheet I need it in.
Can this code be cleaned up so it does not "select" as much, or even get the data without opening the WB?
If I copy the sheet I would need to rename the "code" name of the imported sheet as other sheets use the code name in subroutines.
Code:
Sub ChasImpDatHrs()
Dim StartSheet As Worksheet
Set StartSheet = ActiveSheet
Application.ScreenUpdating = False
wksMHrsData.Cells.ClearContents
Workbooks.Open Filename:= _
"H:\SOD\Cycle_Week_BC\Role_Resources\Data\Hrs_T0_T14_chas.csv"
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Windows("Role Limits5b.xls").Activate
wksMHrsData.Visible = xlSheetVisible
wksMHrsData.Select
wksMHrsData.Range("a1").Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
Windows("Hrs_T0_T14_chas.csv").Close
wksMHrsData.Visible = xlSheetVeryHidden
StartSheet.Select
End Sub
Would it be worth writing code to save the csv file as an xls and then delete a column not needed (causing the problem)?
Thanks, Chas