+ Reply to Thread
Results 1 to 3 of 3

Horizontal then Vertical Loop help

Hybrid View

flindy87 Horizontal then Vertical Loop... 07-04-2013, 06:13 AM
Debraj Roy Re: Horizontal then Vertical... 07-04-2013, 08:44 AM
flindy87 Re: Horizontal then Vertical... 07-04-2013, 09:56 AM
  1. #1
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Horizontal then Vertical Loop help

    Hi,

    I am trying to code a loop that basically looks at a start date and then an end date, if there is a gap between dates the loop will then +1 on to the start date in each column until it equals the end date. This will be filled out horizontol starting from column F.

    I then need the loop to go down a row and start that process again.

    I've attached the example workbook of data i need to apply the loop to.

    Important note, the number of rows will be variable each time i run this report, i have already dim'd this variable with the below code

    Dim totrow As Integer
    totrow = Range("a1").End(xlDown).Row

    I am pretty much a beginner when it comes to loops so i have no code for this (no idea what to do!)

    Any help is appreciated.
    Attached Files Attached Files
    Last edited by flindy87; 07-04-2013 at 10:28 AM.

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Horizontal then Vertical Loop help

    Hi,

    Just the basic to hangout with For Loop...

    Sub test()
    Dim totrow As Long
    totrow = Range("a1").End(xlDown).Row
    For i = 2 To totrow
        For j = 6 To Cells(i, 5) + 6
            Cells(i, j) = Cells(i, "A") + j - 6
        Next j
    Next i
    End Sub
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  3. #3
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Horizontal then Vertical Loop help

    Thank you very much Debraj Roy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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