Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Vicky in the midwest
 
Posts: n/a
Default Excell how to make a cell rotate names when taken off top

In a seniority worksheet columm how can I set it up so that I can make a
macro that will move a name from the top of a column to the bottom sort of
like a rotate?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ken Johnson
 
Posts: n/a
Default Excell how to make a cell rotate names when taken off top

Hi Vicky,
I'm not sure if this is what you are after.
With the following macro, if you select the name of the person at the
top of the list, then run the macro, that selected name is sent to the
bottom and every other name moves up one row to fill the gap.

Public Sub top_to_bottom()
Dim rngRest As Range
Dim vaTemp As Variant
Dim iNumUsedRows As Long
Dim iDemotedRow As Long
iDemotedRow = ActiveCell.Row

iNumUsedRows = Range("A:A").Rows.Count - _
Range(Cells(Range("A:A").Rows.Count, ActiveCell.Column), _
Cells(Range("A:A").Rows.Count, ActiveCell.Column). _
End(xlUp)).Rows.Count

vaTemp = Cells(iDemotedRow, ActiveCell.Column).Value

Set rngRest = Range(Cells(iDemotedRow + 1, ActiveCell.Column), _
Cells(iNumUsedRows + 1, ActiveCell.Column))

rngRest.Copy Cells(iDemotedRow, ActiveCell.Column)

Cells(iNumUsedRows + 1, ActiveCell.Column).Value = vaTemp
End Sub

Ken Johnson

  #3   Report Post  
Junior Member
 
Posts: 1
Unhappy

Quote:
Originally Posted by Ken Johnson View Post
Hi Vicky,
I'm not sure if this is what you are after.
With the following macro, if you select the name of the person at the
top of the list, then run the macro, that selected name is sent to the
bottom and every other name moves up one row to fill the gap.

Public Sub top_to_bottom()
Dim rngRest As Range
Dim vaTemp As Variant
Dim iNumUsedRows As Long
Dim iDemotedRow As Long
iDemotedRow = ActiveCell.Row

iNumUsedRows = Range("A:A").Rows.Count - _
Range(Cells(Range("A:A").Rows.Count, ActiveCell.Column), _
Cells(Range("A:A").Rows.Count, ActiveCell.Column). _
End(xlUp)).Rows.Count

vaTemp = Cells(iDemotedRow, ActiveCell.Column).Value

Set rngRest = Range(Cells(iDemotedRow + 1, ActiveCell.Column), _
Cells(iNumUsedRows + 1, ActiveCell.Column))

rngRest.Copy Cells(iDemotedRow, ActiveCell.Column)

Cells(iNumUsedRows + 1, ActiveCell.Column).Value = vaTemp
End Sub

Ken Johnson
Hi Ken

Do you have one that rotates cells from bottom to top? so that last cell moves to the top and the rest move one down.

Rgds
Nathaniel
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make a formula in Excel to display result in same cell? Neiko Excel Worksheet Functions 2 October 1st 05 10:36 PM
Please make it easier to access the IS functions (e.g., isblank) . melyndac2005 Excel Worksheet Functions 9 August 28th 05 05:06 AM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
How can I Copy cell names from one workbook to another? G.H.B.B. Excel Discussion (Misc queries) 1 March 24th 05 02:30 AM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"