Hi Guys,
I am learning about nested loops but what I cannot determine is how to take values in a 2 dimensional array and through a nested loop move each row down 1 row and create a blank top row for new info to be inserted.
I will call this sub over in over from my main code I am working on to do this simple chore.
I have this practice code to populate the sheet.
Sub nestedLoopFor()
Dim r As Integer, c As Integer
For r = 1 To 20 'row number
'once row number is set it now goes to inter loop to process columns
For c = 1 To 10 'now it process across columns like a typewriter
'at the end it carriage return to next line (r)
Cells(r, c).Value = r & ", " & c 'This takes the coordinance of the current r
'and c and inserts the value requested.
Next c
Next r
MsgBox "Loop Completed"
End Sub
Now I am looking for a separate sub with a loop to move rows down by 1.
It must be a nested loop to handle the rows and columns separately like above
Thank you.
I am learning about nested loops but what I cannot determine is how to take values in a 2 dimensional array and through a nested loop move each row down 1 row and create a blank top row for new info to be inserted.
I will call this sub over in over from my main code I am working on to do this simple chore.
I have this practice code to populate the sheet.
Sub nestedLoopFor()
Dim r As Integer, c As Integer
For r = 1 To 20 'row number
'once row number is set it now goes to inter loop to process columns
For c = 1 To 10 'now it process across columns like a typewriter
'at the end it carriage return to next line (r)
Cells(r, c).Value = r & ", " & c 'This takes the coordinance of the current r
'and c and inserts the value requested.
Next c
Next r
MsgBox "Loop Completed"
End Sub
Now I am looking for a separate sub with a loop to move rows down by 1.
It must be a nested loop to handle the rows and columns separately like above
Thank you.