Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Repetative Task done with VBA code (Excel 2000)

    I have an option button in excel. When it is clicked I want the values of the cells P10 to P60 skipping every other cell to be 4. I want to use a simple "for loop" to do that. For example:

    For i = 10 To 60
    Worksheets("Tally").Range("P $ i") = 4
    i = i + 2
    Next

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,265
    Thanks
    2
    Thanked 187 Times in 173 Posts

    Re: Repetative Task done with VBA code (Excel 2000

    Hi,
    Try:
    <pre>For i = 10 To 60 step 2
    Worksheets("Tally").Range("P"&i) = 4
    Next i
    </pre>

    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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