Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Multiple If's, one variable. And filename as cell contents

Darrin,

For your first question I would suggest using a select case
statement,

ie
myIn = Range("A1").Value
Select Case myIn
Case "A"
MsgBox prompt:="you typed 'A'"
Case "B"
MsgBox prompt:="you typed 'B'"
Case "C"
MsgBox prompt:="you typed 'C'"
Case "D"
MsgBox prompt:="you typed 'D'"
End Select

So you'd have a case for each valid input
look in help (search select case statement)

For your second question use the & operator to join strings
ActiveWorkbook.SaveAs Filename:="C:\" & Worksheets("sheet1").Range("f9:g9").Value & ".xls"

Dan E


"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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make the filename in a link variable based on a cell valu Bekki May New Users to Excel 4 February 4th 09 08:48 AM
Create filename based on cell contents JR Hester Excel Worksheet Functions 7 April 4th 07 11:34 PM
Vlookup Cell Contents Filename deeds Excel Worksheet Functions 1 March 12th 07 07:21 PM
Cell Contents to identify source Filename ThalesNate Excel Discussion (Misc queries) 1 June 7th 06 07:28 PM
Entering a filename as a variable into cell similar as for footer Doug Excel Discussion (Misc queries) 3 May 17th 06 04:39 AM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"