unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hi Gurus,
I have 2 sheets and wanted to move the entire row at the bottom if the cell value is "1".
Sheet 1 - Look for the value of "1" in Column C then move to bottom
Sheet 2 - Look for the value of "1" in Column E then move to bottom
I found this code but is it possible to fix the code and set the column as stated above. The range could be based on Column A
Source : How to move entire row to the bottom of active sheet based on cell value in Excel?
Sub MoveToEnd()
Dim xRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xEndRow As Long
Dim I As Long
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
lOne:
Set xRg = Application.InputBox("Select range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
If xRg.Columns.Count > 1 Or xRg.Areas.Count > 1 Then
MsgBox " Multiple ranges or columns have been selected ", vbInformation, "Kutools for Excel"
GoTo lOne
End If
xEndRow = xRg.Rows.Count + xRg.Row
Application.ScreenUpdating = False
For I = xRg.Rows.Count To 1 Step -1
If xRg.Cells(I) = "Done" Then
xRg.Cells(I).EntireRow.Cut
Rows(xEndRow).Insert Shift:=xlDown
End If
Next
Application.ScreenUpdating = True
End Sub
= = =
Appreciate the help.
I have 2 sheets and wanted to move the entire row at the bottom if the cell value is "1".
Sheet 1 - Look for the value of "1" in Column C then move to bottom
Sheet 2 - Look for the value of "1" in Column E then move to bottom
I found this code but is it possible to fix the code and set the column as stated above. The range could be based on Column A
Source : How to move entire row to the bottom of active sheet based on cell value in Excel?
Sub MoveToEnd()
Dim xRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xEndRow As Long
Dim I As Long
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
lOne:
Set xRg = Application.InputBox("Select range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
If xRg.Columns.Count > 1 Or xRg.Areas.Count > 1 Then
MsgBox " Multiple ranges or columns have been selected ", vbInformation, "Kutools for Excel"
GoTo lOne
End If
xEndRow = xRg.Rows.Count + xRg.Row
Application.ScreenUpdating = False
For I = xRg.Rows.Count To 1 Step -1
If xRg.Cells(I) = "Done" Then
xRg.Cells(I).EntireRow.Cut
Rows(xEndRow).Insert Shift:=xlDown
End If
Next
Application.ScreenUpdating = True
End Sub
= = =
Appreciate the help.