Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 40
Default Moving the second row to the last row

Hi,

I would like to create a macro that moves the second row to the last row in
the worksheet. The worksheet varies in the number of rows and I can not work
out if this is possible or how to do it.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Moving the second row to the last row

Sub Macro1()
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Rows("2:2").Cut
Rows(lastrow + 1).Insert Shift:=xlDown
End Sub

Regards,
Stefi

€˛Max2073€¯ ezt Ć*rta:

Hi,

I would like to create a macro that moves the second row to the last row in
the worksheet. The worksheet varies in the number of rows and I can not work
out if this is possible or how to do it.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Moving the second row to the last row

Forgot to mention that the cell in column A, last row must not be empty!
Stefi


€˛Stefi€¯ ezt Ć*rta:

Sub Macro1()
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Rows("2:2").Cut
Rows(lastrow + 1).Insert Shift:=xlDown
End Sub

Regards,
Stefi

€˛Max2073€¯ ezt Ć*rta:

Hi,

I would like to create a macro that moves the second row to the last row in
the worksheet. The worksheet varies in the number of rows and I can not work
out if this is possible or how to do it.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Moving the second row to the last row

If you are only looking at moving Row 2 to the last position (without
shifting cells) then try the below code.

Sub Macro()
Rows(2).Cut Rows(Range("A" & Rows.Count).End(xlUp).Row + 1)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Max2073" wrote:

Hi,

I would like to create a macro that moves the second row to the last row in
the worksheet. The worksheet varies in the number of rows and I can not work
out if this is possible or how to do it.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Moving the second row to the last row

If column A data is not the last row; then try the below macro

Sub Macro1()
Dim lngLastRow As Long

lngLastRow = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlRows).Row
'to move to last row
Rows(2).Cut Rows(lngLastRow + 1)

'OR - to move to last+1 row and shift
'Rows(2).Cut
'Rows(lngLastRow + 1).Insert Shift:=xlDown
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Max2073" wrote:

Hi,

I would like to create a macro that moves the second row to the last row in
the worksheet. The worksheet varies in the number of rows and I can not work
out if this is possible or how to do it.


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
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
How to pick one or more items out of a list, moving to new list, moving up or down. (form) Subteam Excel Discussion (Misc queries) 3 February 17th 06 04:13 AM
Moving a row Trish Excel Discussion (Misc queries) 3 August 4th 05 08:59 AM
moving last row ukash Excel Worksheet Functions 4 March 24th 05 02:36 PM


All times are GMT +1. The time now is 03:08 AM.

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

About Us

"It's about Microsoft Excel"