Sub TransferData()
Dim LastRow As Long, RowN As Long
Dim WS As Worksheet, WS1 As Worksheet, WS2 As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
RowN = ActiveCell.Row
Set WS = Worksheets("Sheet2")
Set WS1 = Worksheets("Sheet1")
Set WS2 = Worksheets("Sheet3")
WS.Select
LastRow = LastRowColumn("R") + 1
WS.Cells(LastRow, 1).Value = WS1.Cells(RowN, 1).Value
WS.Cells(LastRow, 2).Value = WS1.Cells(RowN, 2).Value
WS.Cells(LastRow, 3).Value = WS1.Cells(RowN, 3).Value
WS.Cells(LastRow, 4).Value = WS1.Cells(RowN, 4).Value
WS.Cells(LastRow, 5).Value = WS1.Cells(RowN, 5).Value
WS.Cells(LastRow, 6).Value = WS1.Cells(RowN, 7).Value
WS.Cells(LastRow, 7).Value = WS1.Cells(RowN, 8).Value
WS.Cells(LastRow, 8).Value = WS1.Cells(RowN, 9).Value
WS.Cells(LastRow, 9).Value = WS1.Cells(RowN, 10).Value
WS2.Cells(LastRow, 1).Value = WS1.Cells(RowN, 1).Value
WS2.Cells(LastRow, 2).Value = WS1.Cells(RowN, 4).Value
WS2.Cells(LastRow, 3).Value = WS1.Cells(RowN, 5).Value
WS2.Cells(LastRow, 4).Value = WS1.Cells(RowN, 7).Value
WS1.Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Sub Del_Inactive()
Dim ID As Long
Dim WS As Worksheet
Dim MatchingID As Long
Dim i As Long
Dim SearchedValue As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ID = ActiveCell.Offset(0, -10).Value
Set WS = Worksheets("Sheet2")
For i = 1 To 10000
If StrComp(WS.Range("B" & i).Value, ID, vbTextCompare) = 0 Then
MatchingID = i
Exit For
End If
Next i
If i < 10000 Then
WS.Rows(MatchingID).EntireRow.Delete
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Function LastRowColumn(RowColumn As String) As Long
Dim sht As Worksheet
Set sht = ActiveSheet
Select Case LCase(Left(RowColumn, 1)) 'If they put in 'row' or column instead of 'r' or 'c'.
Case "c"
LastRowColumn = sht.Cells.Find("*", LookIn:=xlFormulas, SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
Case "r"
LastRowColumn = sht.Cells.Find("*", LookIn:=xlFormulas, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Case Else
LastRowColumn = 1
End Select
End Function