Results 1 to 2 of 2

Thread: Insanity with VBA? =]

  1. #1

    Thread Starter
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    Insanity with VBA? =]

    I was here @ work with a friend, got bored and made this one for Excel. Yes, *that* bored....
    ~~Edited to add~~
    What this does in an Excel worksheet is take the current date starting in cell A1, then from left to right it incriments the date by 1 day cell by cell. It would fill every cell up eventually, except the Y10K bug.
    VB Code:
    1. Sub DateThinger()
    2. Dim Cntr As Long
    3. Dim i As Long
    4. Dim K%
    5.  
    6.     Cntr = 0
    7.         For i = 1 To 65536
    8.                 ActiveSheet.Range("$a$" & i).Select
    9.                 ActiveCell.Value = DateAdd("d", Cntr, Date)
    10.                     For K = 1 To 255
    11.                         Cntr = Cntr + 1
    12.                             ActiveCell.Offset(0, K).Value = DateAdd("d", Cntr, Date)
    13.                     Next K
    14.             DoEvents
    15.         Next i
    16.     Columns("A:IV").EntireColumn.AutoFit
    17. End Sub
    Took about 40 minutes on a Celery 1.1 GHZ with 300 or so megs-O-RAM, it got to row 11,000 or something and crashed, since VBA couldn't swallow the idea of a 5 digit year.
    Last edited by Spajeoly; Jan 16th, 2004 at 04:15 AM.

  2. #2

    Thread Starter
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Here's a working example, I have DoEvents in there, so it's a bit slower than the original, but, you'll be able to hit "Stop" when you get sick of it LoL.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width