Attached is an example using the Change event on the worksheet. You can remove the Close button and associated code. I would have just used an InputBox for this instead of creating a new UserForm but I made changes to accommodate your design.
This is part of your original code. It does not find the first empty cell in a row, it finds the first empty cell in the entire sheet. This will always be A1 on your sheet. Not sure what you are even trying to do there, it doesn't seem necessary.
I also added validation to ensure that what the user enters is a number.
The strategy is for the userform to capture the mileage and make it available in a public variable. After the form is done the calling procedure retrieves the value from the public variable and writes it to the sheet.
Bookmarks