Good Evening, Im hoping you can assist me
I have the following loop that should look through my rows of data for the Value "Y" in column T, for those rows that contain "Y" it should update column K with the variable xdate
For some reason it doesn't seem to work, it changes the first entry it finds and then seems to crash, I have to use CTRL+BREAK to stop it.
Please can you help and let me know what I'm doing wrong ?
Private Sub changedate_Click()
Dim xdate As long
Dim iBegin As Integer
Dim iEnd As Integer
Application.ScreenUpdating = False
On Error GoTo GetOut:
iBegin = 5 ' This is the row that the list starts
iEnd = Sheets("Bookings").Range("B4").End(xlDown).Row
MyNote = "Are you sure you wish to change the date for all marked bookings ?"
'Display MessageBox
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Confirm Date Change")
If Answer = vbNo Then
'Code for No button Press
GoTo GetOut
Else
xdate = InputBox("Please enter new date", "New Date Entry", "dd/mm/yy")
Do While iBegin <= iEnd
With Sheets("Bookings")
If Cells(iBegin, 20).Value = "Y" Then
Cells(iBegin, 11).Value = CDate(xdate)
Else
iBegin = iBegin + 1
End If
End With
Loop
Many thanks, Darren
Bookmarks