#1   Report Post  
TyeJae
 
Posts: n/a
Default Top to bottom


Ok here is my dilema. I have a list of names. At the press of a
button I want to have the top person on the list of names to go to the
bottom and the full list of names shift upwards so there is no empty
space. For example...

a1= Susie
a2= John
a3= Bob
a4= Sarah

Now when I press the button I want it to read...

a1= John
a2= Bob
a3= Sarah
a4= Susie

Then of course if I pressed it again...

a1= Bob
a2= Sarah
a3= Susie
a4= John

And so on...

Could anyone help me out with this?

TyeJae


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701

  #2   Report Post  
TyeJae
 
Posts: n/a
Default


Here is what I have right now, but is there a way to do it without
deleting that cell like I am doing?

Private Sub CommandButton1_Click()
Range("A13").Value = Range("A2")
Range("A2").Value = ""
Range("A2").Select
If Range("A2").Value = "" Then
Selection.Delete Shift:=xlUp
End If
End Sub

And also A13 is currently the end of the list, but I don't want it to
necessarily be A13 always because if I add a name I would have to
change the formula every time.


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701

  #3   Report Post  
TyeJae
 
Posts: n/a
Default


Anybody have a take on this?


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701

  #4   Report Post  
bigwheel
 
Posts: n/a
Default

Well, this assumes the cell under your last name is blank:-

firstadd = Range("a2").Offset(1, 0).Address
lastadd = Range("A65536").End(xlUp).Offset(2, 0).Address
Range("A65536").End(xlUp).Offset(1, 0) = Range("A2")
Range(firstadd, lastadd).Copy
Range("A2").PasteSpecial
Range("A1").Select

"TyeJae" wrote:


Anybody have a take on this?


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701


  #5   Report Post  
TyeJae
 
Posts: n/a
Default


That works but I loose all formatting in my cells...


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701



  #6   Report Post  
Rowan
 
Posts: n/a
Default

I'm not sure why you don't want to delete the cell, unless you have
other data on the row you want to keep in line, but otherwise how about:

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim eRow As Long
eRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(eRow, 1).Value = Cells(2, 1).Value
Cells(2, 1).Delete Shift:=xlUp
Application.ScreenUpdating = True
End Sub

Hope this helps
Rowan

TyeJae wrote:
Here is what I have right now, but is there a way to do it without
deleting that cell like I am doing?

Private Sub CommandButton1_Click()
Range("A13").Value = Range("A2")
Range("A2").Value = ""
Range("A2").Select
If Range("A2").Value = "" Then
Selection.Delete Shift:=xlUp
End If
End Sub

And also A13 is currently the end of the list, but I don't want it to
necessarily be A13 always because if I add a name I would have to
change the formula every time.


  #7   Report Post  
TyeJae
 
Posts: n/a
Default


The reason I don't want to delete the row is because I have formating
which this last post I loose the formating too, but it works really
well. Is there a way to do this where I don't loose the formatting?

TyeJae


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701

  #8   Report Post  
Rowan
 
Posts: n/a
Default

One way would be to use a blank column to store the formatting while you
do the delete (column E in my example):

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim eRow As Long
eRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Range(Cells(2, 1), Cells(eRow - 1, 1)).Copy
Cells(2, 5).PasteSpecial Paste:=xlPasteFormats
Cells(eRow, 1).Value = Cells(2, 1).Value
Cells(2, 1).Delete Shift:=xlUp
Range(Cells(2, 5), Cells(eRow - 1, 5)).Copy
Cells(2, 1).PasteSpecial Paste:=xlPasteFormats
Range(Cells(2, 5), Cells(eRow - 1, 5)).Clear
Application.ScreenUpdating = True
End Sub

Hope this helps
Rowan

TyeJae wrote:
The reason I don't want to delete the row is because I have formating
which this last post I loose the formating too, but it works really
well. Is there a way to do this where I don't loose the formatting?

TyeJae


  #9   Report Post  
TyeJae
 
Posts: n/a
Default


This works great...thank you for your help Rowan!!


--
TyeJae
------------------------------------------------------------------------
TyeJae's Profile: http://www.excelforum.com/member.php...fo&userid=7233
View this thread: http://www.excelforum.com/showthread...hreadid=465701

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
Rows to repeat at BOTTOM. crazybass2 Setting up and Configuration of Excel 0 September 1st 05 11:47 PM
Finding Bottom of Sheet LizzyBorden1369 Excel Worksheet Functions 2 July 1st 05 08:37 PM
Tabs accross of bottom of sheet are not showing robert Excel Discussion (Misc queries) 3 April 22nd 05 09:29 PM
how to paste data from top to bottom to bottom to top Dave Peterson Excel Discussion (Misc queries) 0 January 25th 05 12:12 AM
how to print a row on the bottom of every page Punx Excel Discussion (Misc queries) 1 November 29th 04 04:20 PM


All times are GMT +1. The time now is 12:16 AM.

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"