fastballfreddy
Board Regular
- Joined
- Jan 13, 2015
- Messages
- 57
- Office Version
- 2016
- Platform
- Windows
Trying to add an And to the if statement below (red font) and keeps coming back to wrong# (I type in 1 and cell E1 = 1 so it should type Dice 1 into cell A1). I'm sure it's an easy fix but can't figure out what is wrong with my macro. Thanks in advance for reviewing
Sub Test2()
Dim InputText1 As String
InputText1 = InputBox("Enter #")
If StrPtr(InputText1) = 1 And Range("E1").Value = "1" Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 1"
ElseIf InputText1 = 2 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 2"
ElseIf InputText1 = 3 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 3"
ElseIf InputText1 = 4 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 4"
Else
MsgBox "Wrong #"
End If
End Sub
Sub Test2()
Dim InputText1 As String
InputText1 = InputBox("Enter #")
If StrPtr(InputText1) = 1 And Range("E1").Value = "1" Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 1"
ElseIf InputText1 = 2 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 2"
ElseIf InputText1 = 3 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 3"
ElseIf InputText1 = 4 Then
Range("A1").Select
ActiveCell.FormulaR1C1 = "DICE 4"
Else
MsgBox "Wrong #"
End If
End Sub