If x <> 0 Or <> 1 Then

gtopmafia

New Member
Joined
Jun 8, 2018
Messages
23
Hi Guys,

Can anyone tell me how i can adapt this code.

Basically I use an input box and need a value of 0 or 1. If a different value is entered I want to goto the beginning so they have to enter 1 or 0.

I am not sure how to write this code

If x <> 0 Or <> 1 Then

To test if the value is 0 or 1 without splitting it into somthing like

if x <>0 then
if x <>1 then
gotojump1

This is undesirable as I want it in one line.

This is my code so far:


jump1:
x = InputBox("Which entry method do you wish to use?: " & vbCrLf & _
"Enter 1 for Replacement Method" & vbCrLf & "Enter 0 for New Line Method")
If Not IsNumeric(x) Then
MsgBox ("Not a Valid Entry!")
GoTo jump1
End If
If entryMethod <> 0 Or <> 1 Then
MsgBox ("Not a Valid Entry!")
GoTo jump1
End If


Thanks in advance,
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,812
Messages
6,121,696
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top