After multiple searches using different keywords, I've yet to find anyone having even a similar problem, so I'm not sure what to think here. I have an inputbox that requests a value (building it now so no code written for invalid value types yet). I've written code that adds the value input to the value in a cell, then inserts the total into that cell. The code works only if the value in the inputbox is 1.
This is my code (on a smartphone so formatting will look strange I think):
Sub FuelBuy_Click ()
Dim Answer As (I've tried Single, Double, and String)
Dim PurchaseDatabase As Range
Dim rngMyCell As Range
Dim Buy As Single
Set PurchaseDatabase = Sheets ("Purchase Database").Range ("B8:B1000")
Answer = InputBox ("How many will you purchase?", "Fuel Purchase")
If Answer = vbOk Then
MsgBox ("made it here")
Buy = Answer + Sheets ("Purchase Database").Range("M6")
MsgBox (Buy)
Sheets ("Purchase Database").Range ("M6") = Buy
End If
End Sub
The two message boxes are being used to determine how far the macro is going before terminating. Again, if I enter 1 into the input box, it goes all the way and inserts the new total into M6, but any other numeric value doesn't even ping the first message box. Any help is greatly appreciated. Thank you for your time.
This is my code (on a smartphone so formatting will look strange I think):
Sub FuelBuy_Click ()
Dim Answer As (I've tried Single, Double, and String)
Dim PurchaseDatabase As Range
Dim rngMyCell As Range
Dim Buy As Single
Set PurchaseDatabase = Sheets ("Purchase Database").Range ("B8:B1000")
Answer = InputBox ("How many will you purchase?", "Fuel Purchase")
If Answer = vbOk Then
MsgBox ("made it here")
Buy = Answer + Sheets ("Purchase Database").Range("M6")
MsgBox (Buy)
Sheets ("Purchase Database").Range ("M6") = Buy
End If
End Sub
The two message boxes are being used to determine how far the macro is going before terminating. Again, if I enter 1 into the input box, it goes all the way and inserts the new total into M6, but any other numeric value doesn't even ping the first message box. Any help is greatly appreciated. Thank you for your time.