+ Reply to Thread
Results 1 to 6 of 6

copy 45 rows down, repetativly, only on button click?

  1. #1
    Registered User
    Join Date
    05-23-2005
    Posts
    25

    copy 45 rows down, repetativly, only on button click?

    looking for an if funtion that will check repeatedly down to make sure the possible cell is empty before proceeding with the copy, and then a loop to make it keep searching down if the cell is occupied.
    Thanks alot fellas!
    ~Josh

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Private Sub CommandButton1_Click()

    Row = 7
    Range("A" & Row).EntireRow.Copy
    For i = 1 To 45
    Range("A" & Row + i).PasteSpecial
    Next i

    End Sub


    Mangesh

  3. #3
    Registered User
    Join Date
    05-23-2005
    Posts
    25
    Not getting the results i was looking for... it copies that same row over and over.

    Couldnt i set a row like you did, copy a range and add a .Count dealie to count down 47 rows and paste, then count another 47 and paste... etc?
    Thanks for your help!

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    I assumed you want to copy down for next 45 rows. It seems this is not what you want.

    You wish to copy a row after 45 rows, only once...?

    Mangesh

  5. #5
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Try...
    ------------------------------------
    [vba]Private Sub CommandButton1_Click()

    Row = 7 ' adjust starting point as needed
    Range("A" & Row).EntireRow.Copy
    For i = 0 To 1000 Step 45
    'adjust to meet your needs
    If Range("A" & Row + i) = "" Then Range("A" & Row + i).PasteSpecial
    Next i

    End Sub
    [/vba]
    ------------------------------------

    Does this work for you?
    Bruce
    The older I get, the better I used to be.
    USA

  6. #6
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Try...
    ------------------------------------
    [vba]Private Sub CommandButton1_Click()

    Row = 7
    ' adjust starting point as needed
    Range("A" & Row).EntireRow.Copy
    For i = 0 To 1000 Step 45
    ' adjust to meet your needs
    If Range("A" & Row + i) = "" Then Range("A" & Row + i).PasteSpecial
    Next i

    End Sub
    [/vba]

    If a row has data in A, it will not paste, then skip another 45 rows and repeat....

    Does this work for you?

+ 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