Faster the gathering of one row_with_two_ranges per sheet ?

hemboil

New Member
Joined
Feb 21, 2014
Messages
2
Hello,

I am looking for ways to faster the gathering process of my data : actually I need to copy only 2 ranges [A(i):P(i) and AA(i):AP(i)] for the same row(i) contained in (quite) all the sheets of my worksheet.

Here is my code so far :

Code:
Sub gathering_one_row_with_two_ranges_per_sheet()
<code>Application.ScreenUpdating = False</code>  
RowNumb = 2
  For s = 2 To Sheets.Count
     For lig = 2 To Sheets(s).[A65000].End(xlUp).Row
        If Sheets(s).Cells(lig, 1) = Sheets("regroup").Range("A1") Then
       
             Sheets(s).Rows(lig).Copy Sheets("regroup").Cells(RowNumb, 1)
            'adding name of sheet in Column AAi
             Cells(RowNumb, 27) = Sheets(s).Name
            'adding row number where Ai was found
             Cells(RowNumb, 28) = lig
         
            'adding total # of rows of the sheet
            Sheets("regroup").Cells(RowNumb, 37).End(xlUp)(2) = Sheets(s).UsedRange.Rows.Count
        
            RowNumb = RowNumb + 1
       
        End If
     Next lig
    Next
<code>Application.ScreenUpdating = True</code>
End Sub

Notes :
- I am copying currently the full row(i) as it was faster than just copying only the 2 ranges each time
- There are headers in Sheets("regroup").Range("B1:AP1")
- A(i) can be found at rank #256 for sheet1 and be at rank#458 for sheet2,...and sometimes not available in a sheet.
- I have about about 100 and growing # of sheets and about 1000-6000 rows per sheets
- Every sheets is ranked by column P.

Many thanks in advance ;)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top