greg2935
12-02-2008, 09:54 AM
Hi,
This must be simple but I've not got a glue how to do it. I have a load (40+) checkboxes that essentially do the same thing but with different parameters. Obviously, I would like to pass the various parameters to one function which would save a lot of typing. I can pass some arguments such as a range using
somefunction(D26)
function somefunction(somerange as range)
sheets("Sheet1").range(somerange).Select
end function
or whatever, but I cannot find the correct type to pass the name of the checkbox such as:
somefunction(D26, checkbox1)
function somefunction(somerange as range, thecheckbox as checkbox)
If myForm.thecheckbox.Value = True Then
Sheets("Sheet1").range(somerange).Value = True
End If
end function
I've tried types Range, Name, Names etc and dont seem to be able to find the correct method. Any help?
Greg
This must be simple but I've not got a glue how to do it. I have a load (40+) checkboxes that essentially do the same thing but with different parameters. Obviously, I would like to pass the various parameters to one function which would save a lot of typing. I can pass some arguments such as a range using
somefunction(D26)
function somefunction(somerange as range)
sheets("Sheet1").range(somerange).Select
end function
or whatever, but I cannot find the correct type to pass the name of the checkbox such as:
somefunction(D26, checkbox1)
function somefunction(somerange as range, thecheckbox as checkbox)
If myForm.thecheckbox.Value = True Then
Sheets("Sheet1").range(somerange).Value = True
End If
end function
I've tried types Range, Name, Names etc and dont seem to be able to find the correct method. Any help?
Greg