Macro to rotate data in cells

G

Guest

I have a worksheet that includes data on medical resident students. Each
student will rotate through 12 different departments in a year. Is there away
to create a macro that will automatically shift the departments for each
month so that the cell data shifts down one cell and to the right one cell?
The last cell in a row would need to move to the first cell in the next
column. Example:

Doctor Jan Feb Mar Apr May June
Smith IM Ortho Peds Neuro OB Surgery
Thomas Surgery IM
 
G

Guest

Sue said:
I have a worksheet that includes data on medical resident students. Each
student will rotate through 12 different departments in a year. Is there away
to create a macro that will automatically shift the departments for each
month so that the cell data shifts down one cell and to the right one cell?
The last cell in a row would need to move to the first cell in the next column. Example:

Doctor Jan Feb Mar Apr May June
Smith IM Ortho Peds Neuro OB Surgery
Thomas Surgery IM Ortho Peds Neuro OB

Sorry - I was not finished sending my example. Thank you for your help.
 
B

Bob Phillips

Hi Sue,

Does this do it

Sub MoveData()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
sSave = Cells(iLastRow, 13).Value
Range("B2:M" & iLastRow).Cut Destination:=Range("C3")
Range("N3:N" & iLastRow + 1).Cut Destination:=Range("B2")
Range("C" & iLastRow + 1 & ":N" & iLastRow + 1).Cut
Destination:=Range("C2")

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top