1

I have a function that changes data from an excel spreadsheet into SQL update or insert statements. For the Update section of it, I have up to 4 variables that can get entered into the where clause, but I was wondering if you guys know how to add parameters indefinitely like the SUMIFS function. Here are the parameter declarations:

Public Function SQLCode(Fctn As String, TBL As String, rRange As Range, Optional Where1 As Variant, Optional Where2 As Variant, Optional Where3 As Variant, Optional Where4 As Variant) As String

Do I have any options aside from adding like 20 parameters and hoping nobody needs more than that?

Community
  • 1
  • 1
Jake
  • 66
  • 7
  • 2
    https://msdn.microsoft.com/en-us/library/538f81ec(v=VS.71).aspx http://stackoverflow.com/questions/949263/variable-number-of-arguments-in-paramarray-arglist – dgorti Jan 11 '17 at 19:22
  • `ParamArray` is what you need. http://www.tushar-mehta.com/publish_train/xl_vba_cases/1005%20ParamArray.shtml – Tim Williams Jan 11 '17 at 19:35

0 Answers0