I have a issue with copy/paste the data from one file to another after i changed the range of rows to be transferred. Until now i used a file with 147 rows and 6 columns, no i have to use a file with 579 rows in 6 columns. But when i try to transfer the data with the 549 rows i got the message : "There is already data here. Do you want to replaced it". It is very annoying and i don't know what's happening, while the data is in the same format, only the rows are much more. I think the Separate part is the problem, but not sure. Here's the part of the code, making that issue :
Sub OpenF()
Dim Window As String
Dim sPath As String
Dim VarName As String
Dim GetBook As String
Dim sFile As String
VarName = Sheet1.Range("a4").Value
Window = VarName & "FileName_3_15min.csv"
ChDir sPath & "\Schedule"
' Open the fail
sFile = sPath & "\Schedule\" & Window
If Dir(sFile) = "" Then
MsgBox "File: (" & Window & ") is missing"
Else
Workbooks.Open Filename:= _
sPath & "\Schedule\" & Window
Cells.Select
Selection.Copy
Windows(GetBook).Activate
Sheets("Sheet.5").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Separate
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=";", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1)), TrailingMinusNumbers:=True
Sheets("WindFarmBalchik_2.1").Columns("A:G").AutoFit
' Close the fail
Windows(Window).Activate
Application.CutCopyMode = False
ActiveWindow.Close SaveChanges:=False
End if
End Sub