I am reading and referring to this article on inputboxes http://www.ozgrid.com/VBA/inputbox.htm
I am having a few difficulties with the input box. I want the inputbox to display class number and name relative to the row the input is for, can I somehow acheive this? Also on an exit sub command is it possible to have an are you sure option?
This is where I am at I have tried to comment where I am am stuck.
Code
Sub UserInput()
Lastrow = Worksheets("Datasheet").Cells(Rows.Count, 1).End(xlUp).Row
For Each ce In Range("BI2:BI" & Lastrow)
getchoice = ""
Do While getchoice <> "0" And getchoice <> "1" And getchoice <> "2" ' 0 is 1st, 1 is 2nd, 2 is 3rd
getchoice = InputBox("Enter 0,1 or 2")
Prompt = "This Class & RC[3] & 'Name' & RC[14]" ' Supposed to refer to column C a N relatively. Not working
' Need a skip or exit option if user doesn't want to enter in vlaues.
If rRange Is Nothing Then
Exit Sub ' How do I put an Are you sure you want to exit.
Loop
Select Case getchoice
Case "0"
ce.FormulaR1C1 = _
"=IF(AND(RC[-19]<>0,((RC[-18]*1.65)+(RC[-17])+(RC[-16]*0.8))<>0, _" ' I don't seem to be able to make a new line here?
(RC[-20]-(RC[-20]/((RC[-18]*1.65)+(RC[-17])+(RC[-16]*0.8)))*((RC[-17])+(RC[-16]*0.8)))/RC[-19],0)*1.25"
Case "1"
ce.FormulaR1C1 = _
"=(IF(RC[-14]<>0,(RC[-15]-(RC[-15]/((RC[-13]*1.65)+(RC[-12])+(RC[-11]*0.8)))*((RC[-12])+(RC[-11]*0.8)))/RC[-14],0)*1.25)"
Case "2"
If Range("V2") > 17 Then
ce.FormulaR1C1 = _
"=(IF(RC[-39]<>0,(RC[-40]-(RC[-40]/((RC[-38]*1.65)+(RC[-37])+(RC[-36]*0.8)))*((RC[-37])+(RC[-36]*0.8)))/RC[-39],0))"
ElseIf Range("V2") < 18 Then
ce.FormulaR1C1 = _
"=(IF(RC[-39]<>0,(RC[-40]-(RC[-40]/((RC[-38]*1.65)+(RC[-37])+(RC[-36]*0.8)))*((RC[-37])+(RC[-36]*0.8)))/RC[-39],0)*0.725)"
End If
End Select
Next ce
End Sub
Display More
Edit: having another side issue trying to update this code is that The Next doesn't see the For