☆エコ・ソート/サンプル 〔1〕


'
' SampleDat Macro
' マクロ作成日 : 2008/8/27 ユーザー名 : 寺田屋の龍馬
'
' サンプルデータ100万件をシート1に作成

'
ST$ = Time$

    Dim S1 As Worksheet
    Set S1 = Worksheets("Sheet1")

    Dim R As Long, C As Integer, D As Long, ER As Long, EC As Long, MxC As Integer, IMax As Long
    Dim SampDt(), FF As String

    S1.Range("A1:IV65536").ClearContents

    IMax = 1000000 '対象レコード数

    MxC = (IMax - 1) \ 65535 + 1: FF = String(16, Chr(-1))

    SampDt() = S1.Range(S1.Cells(1, 1), S1.Cells(65535, MxC)).Value
    D = 0

    For C = 1 To MxC

        For R = 1 To 65535

            SampDt(R, C) = Int((1000000) * Rnd + 0.5)

            D = D + 1

            If D = IMax Then ER = R + 1: EC = C: R = 65535

        Next

    Next

    SampDt(ER, EC) = FF

    S1.Range(S1.Cells(1, 1), S1.Cells(65535, MxC)).Value = SampDt()

MsgBox "処理時間..." + Chr$(13) + Chr$(13) + "開始 : " + ST$ + Chr$(13) + Chr$(13) + "終了 : " + Time$ + Chr$(13) + Chr$(13) + "作成件数 : " + CStr(D) + " 件"

End Sub

© Rakuten Group, Inc.
X
Design a Mobile Site
スマートフォン版を閲覧 | PC版を閲覧
Share by: