Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set Property with user input w/o Case or ElseIf

    My macro gives gives the user the option to export a Excel 97 worksheet range according to his/her needs using these properties:
    Cells(r,c).Value
    Cells(r,c).Text
    Cells(r,c).Formula

    Q: How can I make the VBA/Excel 97 interpreter to accept something like this:

    DoItMyWay=Inputbox("How do you want it ? Value, Text, Formula ?","Value")
    .
    .
    XYZ=Cells(r,c).DoItMyWay

    I could do this using Case or ElseIf, but I wonder whether I can do this directly with a one liner.

  2. #2
    calacuccia
    Guest

    Re: Set Property with user input w/o Case or ElseIf

    Hello cri,

    The only method I see is to add code to the running procedure at run-time, and delete it afterwards, by compiling a string from the fixed part ("XYZ=Cells(r,c).") and the response from the user DoItMyWay

    Seems pretty hard though.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Property with user input w/o Case or ElseIf

    calacuccia, thanks, but this really would be overkill. I am only trying to reduce the number of similar calls. I thought this should be easily possible, VBA being an interpreted language.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •