Hi everyone,
I have a table in a locked sheet with a certain number of columns by default. Given that the sheet is locked, the user can't add or remove columns so I'm looking for a way to do something like that in VBA:
When the user clicks on the "Add a column" button, a pop-up window appears, asking for the column name. Once entered by the user, a new column is created (with the name entered by the user as its header) and added to the table (on the right side).
Inversely, a user can click on the "Remove a column" button, which requires to provide the name of the column to be removed. Once entered (and if the column does exist), then the column is deleted.
One particular thing is that the remove button can only remove the columns that were added by the user previously (not the default columns that I created initially).
Here's what I have for now but I don't know if I'm making any mistakes here or if there is a cleaner way to write it:
Add a column:
TO remove the column:Please Login or Register to view this content.
This code does not cover the situation where the user tries to delete one of the default columns (that I dont want him to remove) or if he tries to delete a column that does not exist.Please Login or Register to view this content.
I feel like only VBA can help with that routine but let me know if you think about an alternative!
Thanks a lot
Bookmarks