Ged,
Here is the code. This will evaluate B1 everytime it is changed and if the value is equal to 200, it will move it to Sheet2
This goes in a standard module.
Sub MoveValue()
Dim wsSht1 As Worksheet, wsSht2 As Worksheet
Dim lRow As Long
Set wsSht1 = Sheets("Sheet1")
Set wsSht2 = Sheets("Sheet2")
If wsSht1.Cells(1, 2).Value = 200 Then
'Finds last used cell in column A and adds 1 to it which
'gives the next blank cell in column A
lRow = wsSht2.Cells(Rows.Count, 1).End(xlUp).Row + 1
'If all cells in colunm A are empty the last row formula gives
'a row of 1. This If statement accounts for that.
If lRow = 2 And wsSht2.Cells(1, 1) = "" Then
lRow = lRow - 1
End If
'Moves the data from B1 on Sheet1 to next available cell in column
'A of Sheet2
wsSht2.Cells(lRow, 1).Value = wsSht1.Cells(1, 2).Value
End If
End Sub
This goes in the Sheet1 object.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
Call MoveValue
End If
End Sub
Bookmarks