+ Reply to Thread
Results 1 to 5 of 5

Looping help please

  1. #1
    Christy
    Guest

    Looping help please

    Beginning with the following line of code

    Sheet2.Range("b3").value = Sheet1.Range("b14").value

    I need a loop that will step down 1 row on the left side and 15 rows on the
    right side each time and that will repeat 42 times.

    ie:
    Sheet2.Range("b3").value = Sheet1.Range("b14").value
    Sheet2.Range("b4").value = Sheet1.Range("b29").value

    Any help would be greatly appreciated.

    Christy


  2. #2
    Bob Phillips
    Guest

    Re: Looping help please

    For i = 1 To 42
    Sheet2.Range("B" & i + 2).Value = Sheet1.Range("B" & i * 15 -
    1).Value
    Next i


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Christy" <[email protected]> wrote in message
    news:[email protected]...
    > Beginning with the following line of code
    >
    > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    >
    > I need a loop that will step down 1 row on the left side and 15 rows on

    the
    > right side each time and that will repeat 42 times.
    >
    > ie:
    > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > Sheet2.Range("b4").value = Sheet1.Range("b29").value
    >
    > Any help would be greatly appreciated.
    >
    > Christy
    >




  3. #3
    Christmas May
    Guest

    Re: Looping help please

    You the man Bob, it looks good to me.

    "Bob Phillips" wrote:

    > For i = 1 To 42
    > Sheet2.Range("B" & i + 2).Value = Sheet1.Range("B" & i * 15 -
    > 1).Value
    > Next i
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Christy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Beginning with the following line of code
    > >
    > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > >
    > > I need a loop that will step down 1 row on the left side and 15 rows on

    > the
    > > right side each time and that will repeat 42 times.
    > >
    > > ie:
    > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > > Sheet2.Range("b4").value = Sheet1.Range("b29").value
    > >
    > > Any help would be greatly appreciated.
    > >
    > > Christy
    > >

    >
    >
    >


  4. #4
    Christy
    Guest

    Re: Looping help please

    Thanks for your help Bob!

    I tried this and got the following error

    Method 'Range' of object '_Worksheet' failed

    Can you tell me what I am doing wrong?

    "Bob Phillips" wrote:

    > For i = 1 To 42
    > Sheet2.Range("B" & i + 2).Value = Sheet1.Range("B" & i * 15 -
    > 1).Value
    > Next i
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Christy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Beginning with the following line of code
    > >
    > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > >
    > > I need a loop that will step down 1 row on the left side and 15 rows on

    > the
    > > right side each time and that will repeat 42 times.
    > >
    > > ie:
    > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > > Sheet2.Range("b4").value = Sheet1.Range("b29").value
    > >
    > > Any help would be greatly appreciated.
    > >
    > > Christy
    > >

    >
    >
    >


  5. #5
    Christy
    Guest

    Re: Looping help please

    SORRY! I just had a typo - that worked great
    Thank you!!!!!!

    Christy


    "Christy" wrote:

    > Thanks for your help Bob!
    >
    > I tried this and got the following error
    >
    > Method 'Range' of object '_Worksheet' failed
    >
    > Can you tell me what I am doing wrong?
    >
    > "Bob Phillips" wrote:
    >
    > > For i = 1 To 42
    > > Sheet2.Range("B" & i + 2).Value = Sheet1.Range("B" & i * 15 -
    > > 1).Value
    > > Next i
    > >
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Christy" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Beginning with the following line of code
    > > >
    > > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > > >
    > > > I need a loop that will step down 1 row on the left side and 15 rows on

    > > the
    > > > right side each time and that will repeat 42 times.
    > > >
    > > > ie:
    > > > Sheet2.Range("b3").value = Sheet1.Range("b14").value
    > > > Sheet2.Range("b4").value = Sheet1.Range("b29").value
    > > >
    > > > Any help would be greatly appreciated.
    > > >
    > > > Christy
    > > >

    > >
    > >
    > >


+ 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