Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all
My company has upgraded most of its systems to run 2007 which has created an issue for me as one of my files does not like working with it which I'm fairly certain relates to the sheets column count. I download a CSV file from another company that has to be converted before I can essentially upload it into my workbook so all the "Do Something Stuff"has to be done prior., As I now run 2007 the CSV opens within that version environment and it is here where things go to crap. When it comes time to copying and pasting the entire row ( A to XFD )across to my 2003 structured worksheet which is only ( AA to IV ), it throws a hissy-fit and halts because they are different sizes. If copyLine = True Then Rows(i & ":" & i).Select Selection.Cut Windows(cWkBook).Activate Sheets("TMS DATA").Select Rows(lastrow).Select ActiveSheet.Paste <<< This is the code that actually opens the CSV file, is there a line I can insert at the beginning that would tell the 2007 workbook being opened to reduce it's column count back to ( A to IV ) before it starts doing it's thing.. Sub openCSV(inp As String) On Error Resume Next Workbooks.OpenText Filename:=inp, _ Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _ , Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _ Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _ Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15 _ , 1), Array(16, 1)), TrailingMinusNumbers:=True Columns("F:F").Select Selection.Delete Shift:=xlToLeft Columns("N:N").Select Selection.Insert Shift:=xlToRight For x = 1 To 10000 tVal = Cells(x, 12).Value tVal1 = Cells(x, 13).Value tVal3 = tVal & tVal1 If tVal3 = "" Then Exit For End If tTime = WorksheetFunction.Search(" ", tVal) If tTime < "" Then tTime = Right(tVal, Len(tVal) - tTime) End If tTime1 = WorksheetFunction.Search(" ", tVal1) If tTime1 < "" Then tTime1 = Right(tVal1, Len(tVal1) - tTime1) End If If IsDate(tVal) Then Cells(x, 12).Value = Day(Cells(x, 12).Value) & "/" & Month(Cells(x, 12).Value) & "/" & Year(Cells(x, 12).Value) '& " " & tTime End If If IsDate(tVal1) Then Cells(x, 13).Value = Day(Cells(x, 13).Value) & "/" & Month(Cells(x, 13).Value) & "/" & Year(Cells(x, 13).Value) '& " " & tTime1 End If tVal = "" tVal1 = "" tTime = "" tTime1 = "" Next x Columns("M:M").Select Selection.NumberFormat = "dd/mm/yyyy" End Sub I really appreciate any assistance please.. TIA Mick. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Forcing a certain date format in an Excel column | Excel Programming | |||
Changed column width keeps reverting back to original size | Excel Discussion (Misc queries) | |||
Formula bar height in XL2K3 w/XP | Excel Discussion (Misc queries) | |||
Can we write VBA code to set all column/row's size back to default size? | Excel Programming | |||
Can we write VBA code to set all column/row's size back to default size? | Excel Programming |