![]() |
|
#1
|
|||
|
|||
|
Hello, I have a VBA script in Excel that prompts the user for input and based off that input it will perform a specific function. The issue is my team all uses a different input (plus they forget specifics) so I want to create and use an array so that anything they input will match something in the array. Here is the code: Code:
Sub Test_Variable_Array()
' This is my array - not sure if this is even correct :(
Dim Customer(2) As String
Customer(0) = "Customer"
Customer(1) = "customer"
Customer(2) = "cust"
InputMsg = "Which view would you like to use"
InputTitle = "Filter View"
DefaultText = "Management"
SpreadsheetTitle = InputBox(InputMsg, InputTitle, DefaultText)
ActiveCell.FormulaR1C1 = "Management"
If SpreadsheetTitle = Customer Then
msgbox ("Match Found")
Else
msgbox ("No Match found")
End If
|
|
#2
|
|||
|
|||
|
Found a working solution...
Instead of creating an array I just used and IF/OR statement: Code:
If SpreadsheetTitle = "Customer" Or SpreadsheetTitle = "customer" Or SpreadsheetTitle = "cust" Or SpreadsheetTitle = "Cust" Or SpreadsheetTitle = "C" Or SpreadsheetTitle = "c" Then If anyone knows why this isn't the most efficient way or a better way to do this please chime in. |
|
| Tags |
| array, variable tables, variables |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Taking input from InputBox from user | SeattleITguy | Excel Programming | 1 | 01-28-2015 09:05 AM |
User input to a variable on the document
|
dsm1995gst | Word VBA | 1 | 09-03-2013 03:43 PM |
Replacing text with user input.?.?.?
|
brad1977 | Word | 3 | 11-20-2012 10:20 AM |
| Help with VBA macro - Variable input | sc30317 | Excel Programming | 0 | 08-31-2011 01:00 PM |
| Look up an array based on user input | johnsmb | Excel | 2 | 01-07-2011 01:12 PM |