Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("F")) Is Nothing Then Exit Sub
With Sheets("Hotel unavailable")
.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Target.Value
.Columns("A").Sort Key1:=.Columns("A"), Header:=xlYes
End With
End Sub
Glad we were able to help! Love us? Write us a review! Rate CCM
6897 users have said thank you to us this month
- Posts
- 5
- Registration date
- Sunday August 18, 2019
- Status
- Member
- Last seen
- August 22, 2019
-- Posts
- 2519
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- September 3, 2019
361 -1. Removing item from "Hotel unavailable" sheet when it is deleted from "86 sheet" sheet.
1a. You could run a different macro to delete the item from both sheets. You could assign a shortcut to the macro for easy acces.
1b. But I'm noticing you have the same value in column D. We could use that value to delete the item in the "Hotel unavailable" sheet. This won't require a different action, but when column D is empty the item won't get deleted from the "Hotel unavailable" sheet.
Code for solution 1b:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Columns("F")) Is Nothing Then Exit Sub If Target.Value <> vbNullString Then With Sheets("Hotel unavailable") .Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Target.Value .Columns("A").Sort Key1:=.Columns("A"), Header:=xlYes End With Else Sheets("Hotel unavailable").Columns("A").Find(Target.Offset(0, -2).Value).Delete End If End Sub2. "also the data just goes until column 5"
Do you mean only 5 items will be copied to the "Hotel unavailable" sheet? This doesn't make any sense to me. Could you maybe give an example to help understand?
Best regards,
Trowa
- Posts
- 5
- Registration date
- Sunday August 18, 2019
- Status
- Member
- Last seen
- August 22, 2019
-I mean I want all of the items for the "hotel" to be copied in the "hotel unavailable" sheet but when I was doing it, it just copies 5 items
- Posts
- 2519
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- September 3, 2019
361 -So what you are saying is that, looking at your example, only 5 out of 8 items were copied to the "Hotel unavailable" sheet? For an item to be copied it has to be reconfirmed (double-click cell and hit enter).
I'm still not sure if that is what you meant. But I can't figure out what else you could mean.
Best regards,
Trowa
- Posts
- 2519
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- September 3, 2019
361 -http://ge.tt/9QiVVlx2