Try this Code:
Sub DividData()
    Dim wksSheet As Worksheet
    Application.ScreenUpdating = 0
    With ThisWorkbook
        Set wksSheet = ActiveSheet
         wksSheet.Range("A1:A" & Int((wksSheet.UsedRange.Rows.Count * 70) /
100)).EntireRow.Copy
        .Worksheets.Add.Name = "70%"
        .ActiveSheet.Paste
        wksSheet.Range("A" & Int((.ActiveSheet.UsedRange.Rows.Count * 70) /
100) + 1 & ":A" & wksSheet.UsedRange.Rows.Count).EntireRow.Copy
        .Worksheets.Add.Name = "30%"
        .ActiveSheet.Paste
    End With
    wksSheet.Activate
    Application.CutCopyMode = False
    Application.ScreenUpdating = 1
End Sub

-----Original Message-----
From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Rohan
Sent: Dec/Fri/2011 11:51
To: MS EXCEL AND VBA MACROS
Subject: Re: $$Excel-Macros$$dividing my data set in 70-30 Ratio

Try this.....use this macro

Sub Test()

    Dim RowCount As Integer
    Dim S As Integer
    Dim T As Integer
    LR = Cells(Rows.Count, "A").End(xlUp).Row
    RowCount = LR
    S = Round(RowCount * 70 / 100, 0)
    T = Application.WorksheetFunction.RoundUp(RowCount * 30 / 100, 0)
    Range("A1").Resize(S).Select
    Selection.Copy
    Range("B1").Select
    ActiveSheet.Paste
    Range("A1").Resize(T).Select
    Selection.Copy
    Range("C1").Select
    ActiveSheet.Paste

End Sub



sample data


10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
200
213.3333333
221.9047619


Paste this in the first column and try running the macro. See if it
helps.....on the same basic ground that I have used, u can modiify the macro
as well......Thank you !!

Regards,
Rohan.

--
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security
measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.

----------------------------------------------------------------------------
--------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to