tyrese215
04-25-2012, 10:35 PM
I need some VBA code where the user can select a range using their mouse or keyboard, then
they click on a button and your vba code will create a named range, using the name to the left of the top left of the active range selected.
Please implement this on the workbook attached:
Basically if the user select the range b1:L7 and then clicks the button "Make New NamedRange"
Then the named range that should be created should be "aaa"
We would like some error handling built in so if a named range cannot be created because
there is an invalid character to the left cell of the top left of the active selected range.
So say if aaa was actually "a s cc$@4 4"
Then a message box should appear and say.
Sorry, invalid characters in the desired named range please recheck.
Also, if this named range exists, then the code should say:
Sorry, name range already exists. Please recheck
Lastly, if name range is successfully created we need a message box to appear to read:
Congratulation, named range "xxx" is successfully created
where xxx is the named range name that is created.
Please implement your solution to the attached workbook..
Thank you
they click on a button and your vba code will create a named range, using the name to the left of the top left of the active range selected.
Please implement this on the workbook attached:
Basically if the user select the range b1:L7 and then clicks the button "Make New NamedRange"
Then the named range that should be created should be "aaa"
We would like some error handling built in so if a named range cannot be created because
there is an invalid character to the left cell of the top left of the active selected range.
So say if aaa was actually "a s cc$@4 4"
Then a message box should appear and say.
Sorry, invalid characters in the desired named range please recheck.
Also, if this named range exists, then the code should say:
Sorry, name range already exists. Please recheck
Lastly, if name range is successfully created we need a message box to appear to read:
Congratulation, named range "xxx" is successfully created
where xxx is the named range name that is created.
Please implement your solution to the attached workbook..
Thank you