• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

UserForm using textbox as variable

I have a userform with three textboxes who's input I am trying to use as variables in a macro

I keep getting when
Argument not optimal

I have uploaded a file with the Userform

Thank you
 

Attachments

  • userform.xlsm
    26.5 KB · Views: 1
Hi:

Try changing
Code:
a(i, 2) = a(i, 2) & IIf(a(i, 2) = x, y) & _
                    .Cells(i, r.Column).Value

into
Code:
a(i, 2) = a(i, 2) & IIf(a(i, 2) <> "", x, y) & _
                    .Cells(i, r.Column).Value

I guess you were missing the parameter for IIf SQL, Again I am not sure whether it should be a(i, 2) <> "", it can be anything else based on the logic you are using. Hope this will help you to look in the right direction.

Thanks
 
Nebu
after alille play with what you wrote this worked

Code:
a(i, 2) = a(i, 2) & IIf(a(i, 2) = "", x, y) & _
                    .Cells(i, r.Column).Value

Thank you!!
 
Back
Top