#1
|
|||
|
|||
vba: user input named argument
Hi all,
How can I make a user have a choice how to parse csv data from another worksheet: sep comma or semicolon. I have written the follwing line of code: Sheets("calc").Range("B2:B" & LR).TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=True, Comma:=True, DecimalSeparator:="." Now my idea was to have the user enter either "Comma" or "Semicolon" into a variable via an Inputbox which I could then use in the named argument. However, Excel does not seem to accept a variable instead of a named argument, at least I don't know how to code it. Can someone tell me how to code it, or give me another idea? Thanks for your suggestions. Andreas |
#2
|
|||
|
|||
Hi Andreas
You will have to convert whatever user is offering as his choice via inputbox to a boolean-variable, to meet this syntax (as example): Code:
Sub InsertOption() Dim blnsemicolon As Boolean Dim blncomma As Boolean 'Select Comma: blnsemicolon = False blncomma = True Range("A3").TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=False, _ Semicolon:=blnsemicolon, Comma:=blncomma End Sub |
#3
|
|||
|
|||
Thanks Whatsup,
that's exactly what I needed! Andreas |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formula In Excel To Prompt User To Input Date | pclutts | Excel Programming | 4 | 08-31-2014 12:45 PM |
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 |
Restricting User Input on a TextBox (and setting focus) | joatmon | Excel Programming | 1 | 06-05-2012 03:01 PM |
Look up an array based on user input | johnsmb | Excel | 2 | 01-07-2011 01:12 PM |