BritsBlitz
New Member
- Joined
- Jan 10, 2014
- Messages
- 19
I have the following code to copy a select range of cells from one sheet and past it to another sheet when specific checkboxes are checked:
Rng1 = ("A4:I14")
Rng2 = ("A15:I26")
If Sheets("Setup").Cells(nbr, 3).Value = True Then
Sheets("TestPro").Range(Rng1).Copy
PasteValues
End If
This works fine but I would like to use a For loop so that I can copy and paste multiple ranges without having to retype the copy/paste command every time.
For instance, For nbr = 1 To 2, when nbr =1, I want to copy Range(Rng1). When nbr = 2, I want to copy Range(Rng2) etc. How can I use the nbr integer in my For loop to increase the "number" that follows Rng?
Rng1 = ("A4:I14")
Rng2 = ("A15:I26")
If Sheets("Setup").Cells(nbr, 3).Value = True Then
Sheets("TestPro").Range(Rng1).Copy
PasteValues
End If
This works fine but I would like to use a For loop so that I can copy and paste multiple ranges without having to retype the copy/paste command every time.
For instance, For nbr = 1 To 2, when nbr =1, I want to copy Range(Rng1). When nbr = 2, I want to copy Range(Rng2) etc. How can I use the nbr integer in my For loop to increase the "number" that follows Rng?