I'm trying to create a function that would allow me to pass in a variable that gets added to an object. I want to be able to move a row of values up to the next line in a Form. I want to add a variable so that I don't have to keep repeating the same code for every single row.
Function UpArrow(x As Variant, y As Variant)
Dim TextContent As String
cboOperation +x+ .Value = TextContent
cboOperation +x+ .Value = cboOperation +y+ .Value
cboOperation +y+ .Value = TextContent
I think you are looking for the Controls collection.
Function UpArrow(x As Variant, y As Variant)
Dim TextContent As String
TextContent = Controls("cboOperation" & x).value
Controls("cboOperation" & x).value = Controls("cboOperation" & y).value
Controls("cboOperation" & y).value = TextContent
End Function