jake_barnes
Board Regular
- Joined
- Sep 29, 2005
- Messages
- 55
I'm currently using the code below to take an active range (about 700-800 rows, 5-7 columns) and, skipping empty cells, copy it to a single column. The code works like a champ, but it's slow. Like, one cell per second slow. Any idea how to speed things up?
Sub RequisitionColumn()
Dim rData As Range
Dim r As Range, c As Range
Dim rStart As Range
Dim counter As Integer
Set rData = Selection
On Error Resume Next
Application.DisplayAlerts = False
Set rStart = Application.InputBox(Prompt:="Select the location for the requisition loading.", Title:="Select Output Location", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True
If rStart Is Nothing Then Exit Sub
For Each r In rData.Rows
For Each c In rData.Columns
If Not IsEmpty(Cells(r.Row, c.Column)) Then
rStart.Offset(counter, 0) = Cells(r.Row, c.Column)
counter = counter + 1
End If
Next c
Next r
End Sub
Sub RequisitionColumn()
Dim rData As Range
Dim r As Range, c As Range
Dim rStart As Range
Dim counter As Integer
Set rData = Selection
On Error Resume Next
Application.DisplayAlerts = False
Set rStart = Application.InputBox(Prompt:="Select the location for the requisition loading.", Title:="Select Output Location", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True
If rStart Is Nothing Then Exit Sub
For Each r In rData.Rows
For Each c In rData.Columns
If Not IsEmpty(Cells(r.Row, c.Column)) Then
rStart.Offset(counter, 0) = Cells(r.Row, c.Column)
counter = counter + 1
End If
Next c
Next r
End Sub