hi,
i have a table of 91400 rows and i've tried to run this macro, but it always gets suck and ends up not responding. The original code had integer instead of long, i though by changing this it would help, but it doesn't seem to change anything...
i have a table of 91400 rows and i've tried to run this macro, but it always gets suck and ends up not responding. The original code had integer instead of long, i though by changing this it would help, but it doesn't seem to change anything...
Code:
Sub SheetBBM ()
'Creating BlackBerry table
Sheets.Add.Name = "BlackBerry"
ActiveWorkbook.Sheets("Section_14").Activate
Dim LSearchRow As Long
Dim LCopyToRow As Long
'Start search in row 3
LSearchRow = 3
'Start copying data to row 2 in Sheet2 (row counter variable)
LCopyToRow = 2
While Len(Range("A" & CStr(LSearchRow)).Value) > 0
'If value in column E = "Mail Box", copy entire row to Sheet2
If Range("K" & CStr(LSearchRow)).Value = "BlackBerry usage" Then
'Select row in Sheet1 to copy
Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
Selection.Copy
'Paste row into Sheet2 in next row
Sheets("BlackBerry").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
'Move counter to next row
LCopyToRow = LCopyToRow + 1
'Go back to Sheet1 to continue searching
Sheets("Section_14").Select
End If
LSearchRow = LSearchRow + 1
Wend
'Position on cell A3
Application.CutCopyMode = False
Range("A3").Select
End sub