rodney10954
New Member
- Joined
- Jul 21, 2005
- Messages
- 36
I have 4 ranges of info and i need the first record in each range to be input into specific cells then the results entered someplace. this will do this till the end of the range.
i was able to do this for one range but i dont know how to do it for more than one
Sub ROE()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This selects a range of cells starting from "R16" with a size of "SIZE" '
' Which is 17 now '
' ' '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Range("R16").Resize(Range("Size").Value, 1).Select 'AGE'
Range("S16").Resize(Range("Size").Value, 1).Select 'TYPE'
Range("T16").Resize(Range("Size").Value, 1).Select 'PERIOD'
Range("U16").Resize(Range("Size").Value, 1).Select 'SEX'
Dim cell As Range, myRng As Range
Set myRng = Selection
For Each cell In myRng
'put the value of each cell into Model_Cell
Range("AGE") = cell
Range("TYPE") = cell
Range("PERIOD") = cell
Range("SEX") = cell
'copy formula result & down
cell.Offset(0, 8) = Range("I4")
cell.Offset(0, 9) = Range("I8")
cell.Offset(0, 10) = Range("I14")
cell.Offset(0, 11) = Range("K14")
cell.Offset(0, 32) = Range("I8")
Next cell
End Sub
i was able to do this for one range but i dont know how to do it for more than one
Sub ROE()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This selects a range of cells starting from "R16" with a size of "SIZE" '
' Which is 17 now '
' ' '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Range("R16").Resize(Range("Size").Value, 1).Select 'AGE'
Range("S16").Resize(Range("Size").Value, 1).Select 'TYPE'
Range("T16").Resize(Range("Size").Value, 1).Select 'PERIOD'
Range("U16").Resize(Range("Size").Value, 1).Select 'SEX'
Dim cell As Range, myRng As Range
Set myRng = Selection
For Each cell In myRng
'put the value of each cell into Model_Cell
Range("AGE") = cell
Range("TYPE") = cell
Range("PERIOD") = cell
Range("SEX") = cell
'copy formula result & down
cell.Offset(0, 8) = Range("I4")
cell.Offset(0, 9) = Range("I8")
cell.Offset(0, 10) = Range("I14")
cell.Offset(0, 11) = Range("K14")
cell.Offset(0, 32) = Range("I8")
Next cell
End Sub