When i run my code, i cannot able to paste the value copied from Excel cell into an Input box, but i can able to paste the same value when copied from Notepad into Input box.
Am i missing something here?
My code,
Sub input_box()
Dim Input_value as variant
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Input_value = InputBox(Prompt:="Please enter ID", Title:="Enter ID")
If Input_value = "" Or Input_value = Empty Then
msg = MsgBox("Please enter ID!", vbCritical vbDefaultButton1, "Error")
goto ends:
end if
ends:
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End sub
CodePudding user response:
Is Input_Value declared as a variant, string, integer, ...? Also, the full syntax for InputBox includes a type (see https://docs.microsoft.com/en-us/office/vba/api/excel.application.inputbox)
The type should match how you're declared Input_Value. It will also help edit out bad input
CodePudding user response:
The issue i faced is resolved by disabling Application.Calculation = xlCalculationManual. Now the pasting of values, copied from excel cell is working.