excel macro

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
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I can select the whole block of info i need which would be R16 to U32
each row would have the info i need , if i could copy and paste each row to C3 and transpose it this would work not sure how to do this though
 
Upvote 0
when i try to copy the range it only takes the last cell of the range
so if its a 4x4, 16 cells in all its only returning the last cell
i would like for it to return the bottom 4
 
Upvote 0
i got it working now but i have a question again

right now i used to offset from one cell but now my selection is a row of six so now my offset function is showing my answer 6 times

cell.Offset(0, 8) = Range("ROE") this is what im using now its not working right

how do i offset now
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top