H
Howard
Excel 2010
When I run this code it takes a tiny bit less than one second for each entry with no "X" in the column to the left and at least a full second if it has to cut & paste the resized cells in response to the "X" in the column to the left.
The worksheet also seems to be slower than normal using common sheet procedures like selecting a couple of cells and draging them to another column, same slowness with cut and paste of 150 to 250 entries in a column to another column.
The sheets data is about 50 columns by 300 rows and a "storage column" justover 1000 rows. Doesn't seem like much data after some examples I have heard about in these news groups.
I'm going on poor memory here now, but I seem to recall some reason for slowness may be a HUGE used range on the sheet. Cure was something like selectin all the empty rows beyond what you need and do something with them and then do the same with the columns. Save and restate Excel might be part ofthe cure also. I have used Ctrl + down arrow several times and gone to the million'th plus row (bottom of the column). Maybe thats it???
Any ideas?
Option Explicit
Sub CopyLeft()
'activecell must start row 1 to row 16 of column
Dim c As Range
Dim j As Integer
ActiveCell.End(xlDown).Select
j = ActiveCell.End(xlDown).Row
ActiveCell.Resize(j - 16, 1).Select
With Selection
For Each c In Selection
If c.Offset(0, -1).Value = "X" Then
c.Resize(1, 2).Cut c.Offset(0, -2)
End If
Next
End With
End Sub
Thanks.
Regards,
Howard
When I run this code it takes a tiny bit less than one second for each entry with no "X" in the column to the left and at least a full second if it has to cut & paste the resized cells in response to the "X" in the column to the left.
The worksheet also seems to be slower than normal using common sheet procedures like selecting a couple of cells and draging them to another column, same slowness with cut and paste of 150 to 250 entries in a column to another column.
The sheets data is about 50 columns by 300 rows and a "storage column" justover 1000 rows. Doesn't seem like much data after some examples I have heard about in these news groups.
I'm going on poor memory here now, but I seem to recall some reason for slowness may be a HUGE used range on the sheet. Cure was something like selectin all the empty rows beyond what you need and do something with them and then do the same with the columns. Save and restate Excel might be part ofthe cure also. I have used Ctrl + down arrow several times and gone to the million'th plus row (bottom of the column). Maybe thats it???
Any ideas?
Option Explicit
Sub CopyLeft()
'activecell must start row 1 to row 16 of column
Dim c As Range
Dim j As Integer
ActiveCell.End(xlDown).Select
j = ActiveCell.End(xlDown).Row
ActiveCell.Resize(j - 16, 1).Select
With Selection
For Each c In Selection
If c.Offset(0, -1).Value = "X" Then
c.Resize(1, 2).Cut c.Offset(0, -2)
End If
Next
End With
End Sub
Thanks.
Regards,
Howard