Results 1 to 7 of 7

Do While loop

Threaded View

  1. #1
    Registered User
    Join Date
    08-08-2011
    Location
    Warwick
    MS-Off Ver
    MS365
    Posts
    53

    Do While loop

    Hi Gang,

    I'm a complete beginner to VBA loops. I've got an idea that I want to try out, but i'm unsure as to how to do it.

    OK. I have the following code that selects a number of cells, then performs a paste-special command into a different sheet.

    Sub Macro4()
    
        ThisWorkbook.Sheets("Sheet1").Select
        ActiveSheet.Range("A1:H1").Select
        Selection.Copy
        ThisWorkbook.Sheets("ADMLOD").Select
        ActiveSheet.Range("A3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=True
            
    End Sub
    I need a loop that adds 1 to the first selected range (i.e. Range("A1:H1") becomes Range("A2:H2") and so on...) but also adds 8 to the second selected range (i.e. Range("A3") becomes Range("A11") etc etc). It should loop until the first Range ( Sheet1.Range("A1:H1")) reaches a blank cell.

    Does anyone have any ideas about what I can do? As I said, i'm completely new to loops, but very willing to learn

    Thanks in advance,

    - Jon
    Last edited by JonathanMoore; 09-13-2011 at 04:43 AM. Reason: missed out a bit :P

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