Hello my friends!
I have created this code which turns a range expressed between col A and B - into a list in column F.
So is the start of the range is 10 in A1, and the end of the range is 15 in B1, then f1 is 10, f2 is 11, f3 is 12, f4 is 13, etc.
However my code is static, and will only make the column in F and will only look at the numbers in A1 and B1. But I have more ranges to split up, in A2&B2 and A3&B3, and so on.
How can my code loop through all the ranges expressed between Col A and B on rows 2 and below, and put them into columns after F until exhausted?
I have created this code which turns a range expressed between col A and B - into a list in column F.
So is the start of the range is 10 in A1, and the end of the range is 15 in B1, then f1 is 10, f2 is 11, f3 is 12, f4 is 13, etc.
However my code is static, and will only make the column in F and will only look at the numbers in A1 and B1. But I have more ranges to split up, in A2&B2 and A3&B3, and so on.
How can my code loop through all the ranges expressed between Col A and B on rows 2 and below, and put them into columns after F until exhausted?
Code:
Sub dotest()
Range("f1").Select
Range("f1") = Range("b1")
ActiveCell.Offset(1, 0).Select
If Range("b1") > Range("a1") Then
Do
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value - 1
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Offset(-1, 0) - Range("a1").Value = 0
End If
End Sub