question

Katerina-9278 avatar image
1 Vote"
Katerina-9278 asked Josef-1492 commented

adds a number input into an input box to the value in cell D4. The result should be output in cell G12.

Hi all , I ´m studding at one course of vba programming and cannot resolve this:
Create a subroutine that adds a number input into an input box to the value in cell D4. The result should be output in cell G12.
I think that i´m doing everything weill, but it does not work:
Sub AddNumbersA()
Dim x As Double, y As Double
On Error GoTo Here
x = InputBox("Enter a number:")
y = Range("D4")

Range("G12") = x + y
Exit Sub
Here:
MsgBox ("There was an error")
End Sub

I added error(goto) , added .value to range, but nothing. And by the way F8 is working properly and the code as well, but when I submit it I ´ve the reply that it is incorrect.
Can anyone help me please?
Thank you

office-vba-dev
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


How did you submit it and who said that it is incorrect?

0 Votes 0 ·

I´ve subbeted it by the system of the course, after doing it you receive the reply is it correct pr not, so I received that it is not correct and I have to try again, but I am not sure that there is incorrect.

0 Votes 0 ·

Maybe the system is not so smart.


0 Votes 0 ·
Show more comments

Sub AddNumbersA()
Dim x As Double
x = InputBox("Please enter a number")
Range("G12") = Range("D4") + x

End Sub



0 Votes 0 ·

0 Answers