+ Reply to Thread
Results 1 to 2 of 2

Do...While...Loop...Help!

Hybrid View

systemx Do...While...Loop...Help! 10-17-2006, 01:46 AM
systemx EDIT: Please ignore. I have... 10-17-2006, 01:55 AM
  1. #1
    Registered User
    Join Date
    12-01-2005
    Posts
    45

    Do...While...Loop...Help!

    Hi all,

    Looking for some help on a loop. It's my first attempt at using one of these...so not surprising I am having difficulties.

    I have a userform to record sick days, annual leave and so on. When the user clicks the submit button - the data in the form is written to the next free line. Pretty simple.

    I am trying to add functionality so that the user can add whole blocks of time at once - for instance, two weeks of annual leave. this function would write 10 lines of data (one for each working day) and avoids the user having to change the data and press submit 10 times.

    To keep it simple - I'm working with two combo boxes and just numbers (1-10), not dates. I will deal with the 'weekday' issue after.

    Below is a cut back version of the code I'm using...can anyone please help? The code simply enters the first number - but does not seem to loop.

    Dim MyNumber As Variant

    MyNumber = Me.cboDate.Value

    Do Until MyNumber > Me.cboEndDate.Value

    Sheets("Data").Select
    Range("A1").Select

    Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    nextR = Lastrow + 1

    newR = "A" & nextR
    Range(newR).Select

    ActiveCell.Value = MyNumber

    MyNumber= MyNumber + 1

    If MyNumber > Me.cboEndDate.Value Then Exit Do

    Loop


    Thanks all

    Robert

  2. #2
    Registered User
    Join Date
    12-01-2005
    Posts
    45
    EDIT: Please ignore. I have figured it out now and will post the finished code once completed.

    Cheers

    Robert

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1