Protected Worksheet Macro To Insert Rows?
I have a protected worksheet, which I have 2 macros, 1 to spell check and 1 to insert rows, they both unprotect the sheet and re protect it again once they have completed. The problem I am having is that when I protect the work sheet first time round I tick the box to allow users to insert rows, once the Macros run they disable this functionality. Is there anyway I can include this in my Macros or do I need to add a new button!
View Complete Thread with Replies
Related Forum Messages:
Macro On Protected Worksheet
I have the following macro and when it "reprotects" my worksheet I need it to also turn on these Protect Sheet properties:
and I need it to leave on the defaults of Select locked cells and select unlocked cells
Cells.CheckSpelling "SRdictionary.dic", SpellLang:=1033
ActiveSheet.Protect Password:="pmo", DrawingObjects:=True, _
Run VBA Macro Code On Protected Worksheet
I have incorporated print/print-preview command buttons/VBA into a workbook with protected sheets. To enable these command buttons to function when the relevant sheet is protected, I have had to add VBA code to unprotect the sheet before generating the print preview, and then to protect it again afterwards. However, the code I have used (see below) prompts the user to enter the protection password, is there any code I can use where I can write the password into the code itself to unprotect the worksheet without the using having to enter the password?
'Print preview & cell formatting code
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
Insert Rows On Hidden Worksheet
My workbook contains 10 worksheets. Some users will use all 10 worksheets; some will use only 5 worksheets. If a user is not using a worksheet, I would like to hide it but leave it in the workbook.
However, I want to keep all workbooks in sync even though a user may choose to not use a particular worksheet. When my macros encounter a hidden worksheet, they stall. Does coding exist that allows a Macro to run on a hidden worksheet without making the worksheet visible?
Insert Worksheet Macro Conditional
Still struggling with the calculator. Is there anyway to get a macro to insert a set number of worksheets. The set number would be the sum of two fields on Sheet 1.
Example attached. I have searched the forum and can now use a macro to insert a worksheet but have no idea how to tailor it.
Macro To Insert Rows
I need a macro that will insert 11 rows before the word total. The word total will always be merged between col A&B but will not always be in the same row. It might be in row 5 one day and row 25 the next.
Macro To Insert Rows ..
My sheet needs to insert a blank row under a number everytime it changes.
The column "C" may have 20 or so rows with the number 10 for example, the
next five might be the number 8, I need a row between the last number ten and
the first number eight. This may be repeated many times through the
As well, the adjacent columns "D" & "E" are the same as described above.
all 3 columns are continuous ie: ....
Insert Rows - Macro
I have recorded a macro to insert six rows. I'd like to take this one step further and have the user enter the number of rows they want to insert. Right now the data is entered in A10:F33.
Macro To Insert Rows..
I have a worksheet that includes the list of buildings in an area and the number of households in each building. I want to list the households on separate rows and to number them from 1 to x according to the total number I have. Is it possible to do this using a macro, if so, how?
Insert Rows By Macro
I've created a macro to assign to a button that inserts a row above say row 10, then another macro to assign to a different button that inserts a row above row 20. My problem is, having clicked the first button a row is inserted above row 10 but of course row 20 now becomes row 21, so now I need the second button to insert a row above row 21 instead of 20.
Is there any way I can write a macro that remembers the old row numbers?
Macro To Insert Column Heading To All Worksheet
Pls help me do a macro that upon clicking a button it will copy and paste a column heading (located in Row1 of Sheet1) to all non-empty worksheets (Sheet 2 to Sheet N) in the workbook simultaneously. Note that each worksheet has no column heading and has the same number of columns as that of the column header in Sheet1. Worksheet 2 to Worksheet N contains data extracted daily.
Protected Sheet - Insert Picture File
Workbook Password Protect 2 Levels. I have managed to write simple but effective code that allows only one password to be enetered to open a SS & offers 3 levels of protection, limited permission to enter data, read-only & data completely hidden. This is excellent for my needs however I want the user who has limited rw to be able to insert a pic file which is their signature but because the sheet has protected cells it won't allow user to insert picture jpg file.
I have just thought of a creative solution tho. What if the picture file is already saved in the workbook and by using code to ask to insert pic file it copies from one location in SS to the appropriate cell in the worksheets?
The scenario is that I have fortnightly timesheets in 12 calendar months in 12 separate sheets. When staff member fills in timesheet I want them to insert signature for that f/night indicating thatthey have filled it in & it is correct but because of protection it won't allow me to.
Macro To Insert Rows Part II
i needed a macro that would go through the cells in column A, which is a list of adverstiser and insert a row when the name of the advertiser changed. So the macro needs to compare each cell to the one before and when the values differ, insert a macro. But I need one that will first go through column A, and then once finished with the items in A, go through column B and do the same thing. Can't get the column B to work...
Macro To Insert Formatted Rows
I need columns A, B, and C to have borders all the way around each cell in the row. Then, columns D through H need to be merged, with one border around the merged cell. The row height needs to be size 16 font, which I've been solving by putting in one letter that size, colored white so it doesn't show up when I print.
Basically, I have a spreadsheet of a bunch of tools, and I need to insert a row below each entry for the mechanics to sign their initials for three stages of the repair process, and also have the larger, merged cell for notes.
Macro To Insert Rows In Multiple Tabs
I'm trying to figure out how to create a macro for a project at work. Basically, think of a spreadsheet with 5 tabs, but the information in Tab 1-Column D is the same in Tab-4 Column D and Tab-5 Column D. When I insert a row, though, I have to go to each tab, insert the row, and copy down the formulas from the row above to ensure the flow-through stays true. This can get very tedious.
Does anyone have a template or tips on a macro that would, in essence, work like this:
a) Highlight the row above which a row should be inserted
b) Trigger the macro
c) A row is inserted above the highlighted row in Tabs #1, #4 and #5
d) The information from the row above the inserted row is copied down to the new row in each of the three tabs.
Macro To Insert Defined Number Of Rows
My first sheet shows the data - a list of audits and their current status.
I've then used a simple count formula to add up the number by each stage and it's these numbers that I want the macro to use when determining how many rows to input.
A second worksheet hosts the desired output - a simple report template, split into stages for each status type (completed, planning etc.) with the correct number of rows for each.
Completed AuditsCharlieDeltaReportingBetaAudits in ProgressAlphaAudits in PlanningOmega
So, I want the macro to ensure that we have the right number of rows for each stage, as this month will be run on a monthly basis and the stage each audit is at will change, and the number of rows required in each section will also be different.
Insert Rows Macro & Copy Formats
I need to find a way to insert a row (preferably at the bottom of an existing list) that mirrors the formatting of the row above.
I have had a stab at this (see attached example file) but my solution requires the user to select the correct activecell before it works correctly
Macro To Extract/insert Data Then Delete Rows
I am working with a spreadsheet generated from software that keeps track of fuel usage for a large fleet of vehicles. The data comes out looking like the snapshot below.
I am trying to get the data into a more convenient format for analysis. I need a macro that will:
1) Take the text "Product summary for vehicle ID 0000****", extract the last 4 digits of the text, and paste it where the 1 is under the Product heading (a10). Those digits are the actual fleet number, and I need to separate them out from the rest of the text. The digits will change for each vehicle, so the macro should just move down the spreadsheet doing the same thing for each instance (the setup you see is repeated for every vehicle).
2) Once the first goal is accomplished, I would like the macro to then go back through and delete every row except for the rows with the pertinent data in them. So this means I would only want one row per vehicle and all rows would line up directly below each other like demonstrated below.
VBA Macro To Move & Insert Rows And Average
I would like to have a VBA code to the following:Please note that the rows are dynamic and I need the results row for every customer.Currently it is totalling and displaying the results column at the botton of every customer but I need it at the start of every customer
1.When the new customer number starts the cells are shifted and moved one row.
2.Insert the results word and it displays the results thats displayed currently at the bottom,shoudl be displayed at the top where the row gets inserted in (1)
Customer Date of POD Del date Diff Percent
123456 03.02.2009 03.02.2009 0 100
05.02.2009 10.02.2009 5 0
(The result is that if all the rows are 100% ,the result row is 100% else it is 0%)
Customer Date of POD Del date Diff Percent
123456 Result 0
03.02.2009 03.02.2009 0 100
05.02.2009 10.02.2009 5 0
Macro To Insert Auto Sum Function In Various Rows With A Column
I have to create a spreasheet monthly that has perhaps 60 transactions. The data is in columns A - G, with columns E and F having the costs figures. I need to sum the value in column E and also in Column F every few rows. The problem is that sometimes there are two rows per transaction and other times it could be 30 rows per transaction. Where I will be lucky is that there are two rows between transactions, and the sum goes in the first empty row.
Basically what I would need it to do, from a macro point of view is to go down column E, and every time it finds the first empty row, insert an auto sum. It would then need to ignore the next row, because it too, is empty.
Just Column E - I need an autosum in the "empty row 1's)
empty row 1
empty row 2
empty row 1
empty row 2
VBA Macro To Delete Rows/Columns, Insert Formulas & Auto Fill
I'm running a macro that opens another workbook and read data from it.How can I incorporate this code into my macro.Sorry i don't knwo VBA.
Workbooks.Open Filename:="C:Documents and SettingsmsimantbDesktopINFRACHEM_POLYMERS - DON''T DELETE.xls]Sheet1"
ActiveCell.FormulaR1C1 = "Existing userGroup"............................
Filtering In A Protected Worksheet
I have a protected worksheet where I allow all users of the worksheet to filter yet when I filter, Excel gives a run time error 1004 - you cannot use this command in a protected worksheet. Could someone let me know what am I doing wrong?
Comment Boxes On A Protected Worksheet
I am being asked to create a workbook where 80% of it is protected. And user input is restricted to specific columns and rows.
However the user wants column R unprotected so that Comment boxes can be used, but when I protect the workbooksheet the Insert option is not available when you right click.
Copy And Pasting A Protected Worksheet
I have a protected worksheet that from time to time I need to insert a new row and copy a specific range of cells that are with formulae (protected) to the newly inserted row. For a better idea of what I want to achieve, a snapshot of the worksheet is attached.
ABCDEFGHIJKLMNO22CR NoCodeStatusEstimateContr's PriceDeltaAgreed ValueCommitment Impact Impact ImpactFunded from23 2,730,382.00 320,000.00 180,000.00 241380AIA180,000.00
180,000.00 2,910,382.00 (180,000.00)140,000.00 0.00 180,000.00 0.00 252482AII
0.00 2,910,382.00 0.00 140,000.00 0.00 180,000.00 0.00 26 0.00 2,910,382.00 0.00 140,000.00 0.00 180,000.00 0.00 27 28 180,000.00 0.00 0.00 0.00 180,000.00 2,910,382.00 (180,000.00)140,000.00 0.00 180,000.00 0.00 29 A0.00 2,910,382.00 1036
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
I would like to insert the new row at row27 downwards each time the macro runs.
Data Form On Protected Worksheet.
I have a data list which needs to be updated by others on a shared drive. I want to protect the worksheet as there is other info on it (advancefilter from the main list). The problem is that the >>Data>>Form tool will open, but all the boxes necessary to update the list are greyed out (New, Delete etc.)
My other option is to create a macro to advance filter out the other data to another worksheet.
Adding Comments To A Protected Worksheet
I have (several) worksheets that have protection enabled. I have unlocked all the cells that users need access to and locked all the column and row headers/labels.
When I enabled protection on the sheets, the ability to add comments was taken away.
Is there a way to add comments to an UNLOCKED cell in a PROTECTED worksheet?
Combo Box On Protected Worksheet
I've built a workbook using Excel 2000 that uses several combo boxes. When I try to protect the workbook the combo boxes become locked, even when I have done FORMAT CONTROL / PROTECTION and unticked the LOCKED box. Is this normal?. I also have data validation cells and they work fine if I unlock them and Protect the workbook. As a result, I am thinking of converting the combo boxes to data validation cells, but should I even need to do this
Edit Object On Password Protected Worksheet
I have this password protected Excel template (v.2002), it includes one particular drop-down box, which is not a data validation choice selection, but a 'object' drop-down box which offers choices linked to a hidden value, via the INDEX function. The issue arises when I password protect the template and attempt to select from the available choices, I get a dialog box telling me the "the cell or chart...is password protected and...read-only"..."To modify...remove protection". I imagined checking the "Edit Objects" selection, upon protecting the worksheet would have avoided any problems, but that doesn't do the job.
Clearing Unlocked Cells On A Protected Worksheet
I have a workbook with a series of sheets that have tables for entering data. The table row and column labels and formulas in certain cells of each sheet are locked and some sheets are hidden.
When opening the file I want to clear all cell contents (interior color, comments, data, etc) in all the unlocked cells on each sheet that is not hidden.
I tried protecting the sheets first so only the unlocked cells would be accessible, but when I run the code below I get an error saying that the clear contents etc. cannot be performed because the sheet is protected. If it is not protected, everything gets wiped out.
How can I keep the locked stuff but clear the unlocked cells?
For Each ws In ThisWorkbook.Worksheets
If ws.Visible = xlSheetVisible Then
ws.Protect Password:="aaa" 'Protect each sheet
ws.Cells.ClearContents 'clear content of any unprotected cells
ws.Cells.ClearComments 'clear any cell comments
ws.Cells.Interior.ColorIndex = 0 'set background colour to no fill
Active.Cells.Range ("a1") 'make the active cell the top left
Group & Outline On Protected Worksheet
I curently using the group and outline to subtotal certain data. I do not want to data to be modified. As a result I protect the particular sheet. Problem is once I protect the worksheet, I can't expand the data hidden (using the group & outline). Is there anyway that i can expand the data & in the same time protect the
data. A sample in enclose(without worksheet protected)
Allow Cell Entry In Some Cells On Protected Worksheet
I know that there is a lot on locking cells but it is confusing to me. I am able to lock a worksheet but that is not what I need. I have an Excel document that has thirty to thiry-six names on it. I do not want anyone able to edit the names. But I do want them to be able to add a name.
There are 30 students in the classroom. A new student comes in. I want the teacher to be able to add that student to the roster but not able to edit the names above. What do I need to do?
Arrow Keys Not Working On Protected Worksheet
Have a file that I have been coding and find when I open to a worksheet with limited access cells, the Up and Down arrows will not move vertically though Lrft and Right arrows OK though not raping arround. This problem may have been on for sometime and I haven't been back to it. Other Excel files all OK.
Sort Protected Worksheet Excluding Blank Cells
I need to protect my worksheet and only allow users to edit certain ranges. I am allowing the use of autofilter which I can select when I apply protection. However, I am now aware I cannot sort protected cells..which is essential. I basically need to be able to sort a column titled 'surname'. The worksheet is a record of pupils attainment in my class.
Now, I have a macro which seems to do the job: ....
Allow Sorting: Protected Worksheet Doesn't Allow A Sort
I have a column containing 365 entries, one for each day of the year. This I intend to send out to Army bands, to have them fill in their forecast of engagements. I do not want them to be able to amend the original diary, but to scroll to the bottom of the list, add a new entry with the applicable date and then be able to 'sort' back to chronological order. This would then allow a separate entry for every engagement to allow me to interrogate the spreadsheet. As I have protected the sheet, the 'sort' facility does not function even though when protecting I ticked the box to allow users to 'sort'.
Macro To Delete Any Blank Rows In A Worksheet
I've added a button with a macro to delete any blank rows in a worksheet.
Cell A3 is completely blank and A6 has an IF formula which returns "". In my macro it copies the whole worksheet and then paste special values, to take away the formula in A6 and then deletes the blank rows but it still does not delete row 6.
Loop Or Macro To Retrieve Rows Of Data From Other Worksheet
I need to query a master spreadsheet and pull out all the rows on it that have the same name as I have in cell A1 of my spreadsheet
Myworkbook, sheetname = queries
Cell A1 = "ABC"
The Macro queries the "test Data" workbook (c:myfolder estdata.xls) "sheet x" and looks in column A for ABC, if it finds ABC it will copy the row and paste it into Myworkbook, sheetname = queries. There are often several rows of data that need to be copied that all have "ABC" in column A.
Also, in column B of the test data workbook, is a number, the highest value denotes the "version" of the data, the highest number is always the latest version of data that should be retrieved, e.g. if 9 the highest value in column B then all data that has ABC in column A and has 9 in column B should be retrieved, all other records should be ignored.
I guess this is a sort of a macro loop but not too sure how to do it.
Sub Worksheet Change Range Color Error Due To Protected Sheet
I have this code that works fine until I password the sheet and the range (b9:d65536) is protected. When I protect the sheet and make a change I get a debug error. What would I need to add/change to handle protected cells on a protected sheet?
VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes" ....
Allow Hide & Unhide Column/Rows On Protected Sheet
I'm familiar with the code to allow grouping/ungrouping in a protected spreadsheet; http://www.ozgrid.com/Excel/outlining-protected.htm. How would I code to allow for hiding/unhiding cloumns and rows while still protecting the spreadsheet? Also, how could i allow for this file to be shared? Currently i'm getting an debug error when another person enters the file.