Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving Data between sheets in the same workbook and moving data between Workbooks. | Excel Worksheet Functions | |||
Arrow Keys Moving Window Frame instead of Moving Between Cells | Excel Discussion (Misc queries) | |||
How to pick one or more items out of a list, moving to new list, moving up or down. (form) | Excel Discussion (Misc queries) | |||
Moving a row | Excel Discussion (Misc queries) | |||
moving last row | Excel Worksheet Functions |