Input box not working with IF statement

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Sub answer()
If Sheet1("C3") = True Then

x = InputBox("Width?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A1") = x

y = InputBox("Height?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A2") = y

Else: End If

End Sub


I think the way I've written it will explain what I want to do.
Basically, if C3 is True, based on a checkbox, then I want input. If
not, I don't.

But I get a Runtime Error 438, Object not supported when I check or
uncheck the checkbox. I tried adding the Sheets. before the Sheet1
attribute but then get a method or data member not found error.

Any help appreciated.

Thanks.
 
Sub answer()
If Sheets("Sheet1").Range("C3").Value = True Then

x = InputBox("Width?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A1") = x

y = InputBox("Height?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A2") = y

End If

End Sub
 
Tom said:
Sub answer()
If Sheets("Sheet1").Range("C3").Value = True Then

x = InputBox("Width?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A1") = x

y = InputBox("Height?", "Lites", vbOKCancel)
Sheets("Sheet1").Range("A2") = y

End If

End Sub

Ahhh dang... I'm a dope. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top