Distribute 35000 Rows equally into 6 different excel sheets

rajkumarthakur1

New Member
Joined
Oct 3, 2005
Messages
32
Hi XL Gods,

I am stuck with this....I have a set of 35000 records which i want to distribute equally between 6 user..ie distribute 35000 records in 6 equal sheets....I am using Autofilter-->Top10 items and selecting the percentage required to distribute...but unable to do so......Please people help me I am stuck with this....



Can any1 please help me
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
35,000 records / 6 sheets = 5,833.33 records per sheet so things will not come out EXACTLY equal but it is a simple matter to break up one sheet of 35,000 into 6 sheets of 5,833 using cut and paste or Copy Sheet.
 
Upvote 0
Hi,

Try,

Code:
Sub kTest()
    Dim a, w(), i As Long, n As Long, h As Long, c  As Byte
    a = Sheets("Sheet1").[a1].CurrentRegion.Value
    h = Int((UBound(a, 1) + 1) / 6) + 1
    ReDim w(1 To h, 1 To UBound(a, 2))
    n = 1
    For i = 1 To UBound(a, 1)
        For c = 1 To UBound(a, 2): w(n, c) = a(i, c): Next
        If n = h Then
            Sheets.Add after:=Sheets(Sheets.Count)
            ActiveSheet.[a1].Resize(h, UBound(a, 2)) = w: n = 0
        End If: n = n + 1
    Next
    Sheets.Add after:=Sheets(Sheets.Count)
    ActiveSheet.[a1].Resize(n - 1, UBound(a, 2)) = w
End Sub

HTH
 
Upvote 0
a = Sheets("Sheet1").[a1].CurrentRegion.Value

HI Krishnakumar, just wondering if you could explain me what does [a1] mean...I was trying to figure it out, but I can´t :cry:
Oh... in that expression I quoted, you are setting "a" as a range?
Thanks!!!!!!
 
Upvote 0
Hi XLgods,

I needed to prevent the copy paste activity on a particular excel sheet....Please can any one help me...i need it urgent
 
Upvote 0
Hi,

Sub kTest()
Dim a, w(), i As Long, n As Long, h As Long, c As Byte
a = Sheets("Sheet1").[a1].CurrentRegion.Value
h = Int((UBound(a, 1) + 1) / 6) + 1
ReDim w(1 To h, 1 To UBound(a, 2))
n = 1
For i = 1 To UBound(a, 1)
For c = 1 To UBound(a, 2): w(n, c) = a(i, c): Next
If n = h Then
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.[a1].Resize(h, UBound(a, 2)) = w: n = 0
End If: n = n + 1
Next
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.[a1].Resize(n - 1, UBound(a, 2)) = w
End Sub

The Above code some times works fine but some times dose not and give the following error

Run-time error 1004
Application-defined or object-define error

when I click on debug it highlights the following

ActiveSheet.[a1].Resize(h, UBound(a, 2)) = w


Kindly help me out what is the problem.

Regards,
Shafiq
 
Upvote 0

Forum statistics

Threads
1,223,832
Messages
6,174,905
Members
452,590
Latest member
CraiginColorado

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