...far too often. I'm using Excel 2007 on Win8.1, which is part of the problem with max 255 columns, but I really need to address the problem not the symptom anymore.
The process is really straight forward. The range of outcomes is ridiculous though! The 2 macros below, LIFE savers, are used so I can highlight multiple non-adjacent rows at once (i.e. row 2 through 15 to column P, then row 30 through 45 to column P, and so on.) AND 'in affect' cut those rows to the Windows clipboard for pasting into a new workbook or with the other macro automatically paste the 'cut' rows into a new workbook. (i.e. row 1 through 28 to column P)
...And instead ALL the data pastes INTO ROW 1, FAR too often! What really sucks is that when it happens with over 15-16 rows of data the full range ends up outside the 255 max columns rang and is gone for good!
Obviously it's a CR/LF issue. But I've viewed all file types many many times in a text editor displaying all characters and it's all over the place! Both versions of excel are completely random! And instead of \r\n I see only random single character at the end of each line, either \r or \n.
CSV files always end each line with the proper CRLF as it should, but STILL at times losses ALL line breaks and 100% of the time when rows are copied/cut into a new blank workbook and not saved and closed, then cut from that workbook into another.
This lack of any rhyme or rhythm to why this happens so sporadically is really frustrating. ALL unsaved files, MOST .xlsx files then it's about 50/50 on .xls files this occurs. CSV files are by far the best, but not only does the file have to be saved, but it has to be close and reopened before the row (line breaks) are maintained! Even then at times with csv files, no line breaks. All data pastes into row 1.
It's been such a problem I had to get help to make another macro that would fix the data, bringing the range of rows, now ALL on row 1 back to the rows where it goes.
It's been 6 months and it's driving me nutzo! There HAS to be some parameters that can be added to the following macros so this stops happening...I'm REALLY hoping.
This macro 'Cuts' multiple non-adjacent rows and pastes to a new workbook automatically.
This one 'Cuts' multiple non-adjacent rows to clipboard for manual paste.
Thank you for any possible guidance!
Mark
The process is really straight forward. The range of outcomes is ridiculous though! The 2 macros below, LIFE savers, are used so I can highlight multiple non-adjacent rows at once (i.e. row 2 through 15 to column P, then row 30 through 45 to column P, and so on.) AND 'in affect' cut those rows to the Windows clipboard for pasting into a new workbook or with the other macro automatically paste the 'cut' rows into a new workbook. (i.e. row 1 through 28 to column P)
...And instead ALL the data pastes INTO ROW 1, FAR too often! What really sucks is that when it happens with over 15-16 rows of data the full range ends up outside the 255 max columns rang and is gone for good!
Obviously it's a CR/LF issue. But I've viewed all file types many many times in a text editor displaying all characters and it's all over the place! Both versions of excel are completely random! And instead of \r\n I see only random single character at the end of each line, either \r or \n.
CSV files always end each line with the proper CRLF as it should, but STILL at times losses ALL line breaks and 100% of the time when rows are copied/cut into a new blank workbook and not saved and closed, then cut from that workbook into another.
This lack of any rhyme or rhythm to why this happens so sporadically is really frustrating. ALL unsaved files, MOST .xlsx files then it's about 50/50 on .xls files this occurs. CSV files are by far the best, but not only does the file have to be saved, but it has to be close and reopened before the row (line breaks) are maintained! Even then at times with csv files, no line breaks. All data pastes into row 1.
It's been such a problem I had to get help to make another macro that would fix the data, bringing the range of rows, now ALL on row 1 back to the rows where it goes.
It's been 6 months and it's driving me nutzo! There HAS to be some parameters that can be added to the following macros so this stops happening...I'm REALLY hoping.
This macro 'Cuts' multiple non-adjacent rows and pastes to a new workbook automatically.
Code:
Sub CopytoClipboardDeleteNewandPaste()
Dim obj As New MSForms.DataObject
Dim x, str As String
Dim count As Integer
count = 0
For Each x In Selection
count = count + 1
If x <> "" Then
If count = 1 Then
str = str & x
Else
str = str & Chr(9) & x
End If
End If
If count = 16384 Then
str = str & Chr(13)
count = 0
End If
Next
obj.settext str
obj.PutInClipboard
Selection.Delete Shift:=xlUp
Workbooks.Add
ActiveSheet.Paste
End Sub
This one 'Cuts' multiple non-adjacent rows to clipboard for manual paste.
Code:
Sub CopytoClipboardandDelete2()
Call SaveWorkbook
Dim obj As New MSForms.DataObject
Dim x, str As String
Dim count As Integer
count = 0
For Each x In Selection
count = count + 1
If x <> "" Then
If count = 1 Then
str = str & x
Else
str = str & Chr(9) & x
End If
End If
If count = 16384 Then
str = str & Chr(13)
count = 0
End If
Next
obj.settext str
obj.PutInClipboard
Selection.Delete Shift:=xlUp
Sheets.Add after:=Sheets(Sheets.count)
ActiveSheet.Paste
Selection.Cut
ActiveWindow.SelectedSheets.Visible = False
End Sub
Thank you for any possible guidance!
Mark