Hi there,
I'm attempting to put together a macro for a small work project, I'm trying to create an input box that will allow the user to search for a reference within the 20th column and then copy and returned results to another worksheet.
This works perfectly for retrieving, copying, and pasting the data, the downside is if the user clicks "Cancel" or enters a value which isn't available in the 20th column it will continue to execute the macro (there is more to the macro than what's below, but this is my issue currently).
If anyone is able to assist that would be greatly appreciated.
Thank you,
Ben
I'm attempting to put together a macro for a small work project, I'm trying to create an input box that will allow the user to search for a reference within the 20th column and then copy and returned results to another worksheet.
This works perfectly for retrieving, copying, and pasting the data, the downside is if the user clicks "Cancel" or enters a value which isn't available in the 20th column it will continue to execute the macro (there is more to the macro than what's below, but this is my issue currently).
VBA Code:
Sheets("Cosh Dump").Select
ActiveSheet.Range("$A$1:$U$44415").AutoFilter 20, InputBox("Please enter Reference") & ""
ActiveWindow.ScrollColumn = 2
Range("A2:M50000").Select
Range("M50000").Activate
Selection.Copy
Sheets("Workings").Select
Range("A2").Select
ActiveSheet.Paste
If anyone is able to assist that would be greatly appreciated.
Thank you,
Ben