ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple If's, one variable. And filename as cell contents (https://www.excelbanter.com/excel-programming/276655-re-multiple-ifs-one-variable-filename-cell-contents.html)

steve

Multiple If's, one variable. And filename as cell contents
 
Darrin,

For your first question:
You might want to use a ComboBox or ListBox since you say there are
50 valid entries (you already know what they are). This way you will
eliminate typo errors. And maybe your messages are standard to each.
Than you can create two lists in your workbook. One for the input and one
for the message. Than you can just use a lookup or Index-Match function
to retrieve the message and avoid the If's or Select Case.

--
sb
"Darrin Henry" wrote in message
...
Hello,
I have a few questions that are currently stumping me.

1) I have an input box. What the user puts in is declared as a variable.
Based on what they put in I want to return a msgbox. The problem is
there are 50 possible valid entries the user can input. Will multiple IF
statements work? Or another way?

2) I also I am trying to create a command button, that will save the
workbook, however, the filename is going to be the contents of a cell.
This is what I have now:

Private Sub CommandButton1_Click()

ActiveWorkbook.SaveAs Filename:="C:\"
Worksheets("sheet1").Range("f9:g9").Value ".xls"
End Sub

Any idea what is wrong? I get a runtime error 1004, on it. Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com