I have an excel worksheet with 2 comboboxes, and 3 scrollbars. I want to protect all the sheet except this form objects (and one cell). When i try to protect the sheet, i can't use the scrollbars and comboboxes. How can i unlock them, keepin the protection for the rest of the sheet with vba ? I tried to unlock the cells linked to the form objects but it still doesn't work.
Thank u
AB
Why not put the cells that need to be modified on a very hidden worksheet.
Create a named range e.g. "InputCell" in a separate worksheet e.g. "SheetWithInputCell". Set the cell link of the combobox to the named range using =InputCell.
Then set the worksheet to VeryHidden. VeryHidden means that users can't right-click on the sheet tabs and unhide it.
To set the sheet to very hidden, go to the VBA IDE (Alt+F11) and look at the Properties window. If you can't see the Properties window, select View > Properties Window.
In the Project Explorer window (View > Project Explorer), select the worksheet to hide and set the Visible property to xlSheetVeryHidden.
Then you can leave the hidden sheet unprotected and lock the sheet with the controls.
What about Menu option Data --> Allow Users to Edit Ranges?
Related
I have a form that makes list of values from selection as can be seen here:
I have added the opportunity to enter the list in Excel. I will select the cell and click on "Enter data in Excel":
But what I would like to do is to have the possibility to enter data to another workbook, but when I select another workbook the form is no longer active.
I know I can reference another workbook and other worksheets in VBA code, but I would like to have the possibility to select the cell in another workbook by clicking on it.
Change the form's ShowModal property to 'False'. This is found in the object property window when the object is selected in the Visual Basic editor. That should allow it to remain open when you change workbooks.
I have a specific worksheet with 2 sheets(Sheet1 & Sheet2). For Sheet2 I have implemented a form for the table (Using the basic Excel Form from the top bar).
My problem is that I have to make the form appear automatically every time I open Sheet1 (even if the data from the form will be completed in Sheet2).
Is this possible? Or how can I do it? (I can also use VBA)
To show the DataForm associated with a Worksheet, you use the command Worksheet.ShowDataForm (MSDN Article)
To show the DataForm for Sheet1 whenever you go to Sheet2, you can use the Worksheet_Activate event in Sheet2, like so:
Option Explicit
Private Sub Worksheet_Activate()
Sheet1.ShowDataForm
End Sub
A quick way to figure things like this out is use the "Record Macro" button, carry out the action you want, and then hit "Stop Recording" and look at the macro
I have 2 sheets in excel where if you tick the checkboxes on the first sheet it hides or unhides the rows on sheet2. I used active x controls and set checkbox properties to 'move and size with cells' but when i unhide the rows, the checkboxes disappear but are still in the document as their height changes and remains at 0.(the rows appear just fine). Please help!!
ActiveX checkboxes are reknown for problems like these. FOrms checkboxes are a bit better, but I would advise to just use cells with data validation set to list and have it accept 0/1 or True/False. It is relatively easy to set up an event macro that toggles the value of those cells after a double-click for instance.
I'm creating formated worksheets with an Excel VBA application and I would like to add programmatically add a button to each worksheet when created. This button must have a macro attached to it, which display the average of the values in a certain range in a special cell, and change the background color of this cell depending on the value of the average. Is it possible to this, and if yes, how can I do it ?
You can add the Button like this or example:
ActiveSheet.Buttons.Add(52.5, 7.5, 173.25, 41.25).Select 'Arguments are coordinates
Selection.OnAction = "Button_Click"
Now make sure the Button_Click sub has the logic you want.
I would really appreciate any help on the following....
I am looking to create a userform to import external worksheets from open workbooks into the current workbook - My aim is to use 2 drop down lists and one submit button:
First drop down box: Lists all open workbooks - User clicks to specify which is required.
Second box: Lists all worksheets within the selected workbook in the first box - User clicks to specify which is required.
Submit button: When submit is clicked, the macro will take a copy of the workbook/worksheet combination specified in the dropdown boxes and paste this as a new tab in the main workbook.
Thanks in advance.
You can list all workbooks and worksheets in a combo box like they did in this post
You can link the workbook / worksheet combo boxes by 'dependent drop down list', see this post. Note that you need an on-change event fired when the first combo value is selected in order to populate the second combo.
Finally, you can copy worksheets from another workbook as shown in this post