Excel 2013 :: Can't Unprotect Worksheet Created With VBScript

Aug 2, 2014

I've written a little VBScript that generates several hundred Excel 2013 worksheets. In order to protect the users from themselves I protected certain cells. Everything works as expected, except when I discovered that the password I used to protect the worksheet doesn't work to unprotect it. If it matters, I'm not trying to unprotect programmatically, just opening Excel and going that route.

Here's a snippet of my code:

objWS.protect Password="abc123"

View 2 Replies


ADVERTISEMENT

Excel 2013 :: Macro That Can Reference Worksheet It Has Created

Jul 4, 2014

I am completely new to Macro's and VB and the macro below has been generated using the "Record Macro" function in Excel 2013 with a couple of very minor modifications based on some research I have done (hyperlink & input box). My ultimate goal is to make a copy of my "TEMPLATE", which is hidden and the copy could have a variety of names, then create an entry in my "SUMMARY" table that references cells on the newly created sheet. The new entry on the SUMMARY page should be entered in the next available row ... at the moment I need to make sure I have my cursor in the right place before I run the macro. I also want the first cell in the new "SUMMARY" row to create a hyperlink to the newly created worksheet.

The macro does what I need it to do, as long as I name the new sheet "Test", what I would like is for the Macro to recognise the name of the new worksheet and create links to that name. The rows and columns in each new sheet will remain the same, hence the R##C## part will always work.

The "SUMMARY" and "TEMPLATE" worksheet names will not (ever) change.

View 4 Replies View Related

Excel 2013 :: Speed Protect / Unprotect Sheets

Apr 29, 2014

I experience it takes a lot of time to protect/unprotect sheets in Excel 2013. However, only if the operation is made WITH PASSWORD. This was not the case in Excel 2007. Operation was fast independent with/witout password.

In attached file I have made an example where the time to protect/unprotect 25 sheets is investigated. Can make the test in Excel2013 to double check it is not my computer causing the time delay.

Result test - 25 sheets:
Protect - No password: 0,02 s
Unprotect - No password: 0,06 s
Protect - With password: 6,9 s
Unprotect - With password: 6,9 s

View 7 Replies View Related

Excel 2007 :: How To Unprotect Worksheet

Aug 5, 2013

How can I unprotect MS excel 2007 sheet. I have forgotten the password.

View 1 Replies View Related

Get Names Of All Worksheets In One Worksheet Without VBScript

Jun 18, 2012

Basically I want to be able to get the names of all sheets in a workbook. I know how to get Excel to print the name of the sheet in a cell once the file is saved, and I know how to hide sheets to make sure that all sheets are referenced in a range. If the name of the worksheet is in the same cell across all sheets (except the ones I don't want included on the totals page), is there a way to call that range and have Excel print off all the worksheet names in different rows or columns via a fill function?

Difficulties: the user may add/delete, rename, and have any number of, worksheets in the workbook. Because these variables are unpredictable, I am having difficulty figuring out the way to do this. Also, the formula should be able to ignore the sheets which have no value in the expected cell.

View 5 Replies View Related

Excel 2003 :: Change Value In A1 By One Each Time Worksheet Created

May 3, 2012

I am creating an invoice form in Excel 2003. I like to know if it is possible to increase the value of cel A1 by one everytime a new sheet is created.

For example i created my first worksheet and gave an invoice number 001. Now I create a new worksheet by right clicking on the tab and choose copy/move. I like the second work sheet change the invoice number to 002.

View 8 Replies View Related

Excel 2013 :: Worksheet Freeze With Application?

May 28, 2014

I encountered a strange anomaly where a worksheet "freezes" when Application.DisplayFormulaBar = False. I can only replicate this in Excel 2013. Excel 2010, for example, works perfectly well, and as expected.

[Code].....

To replicate the anomaly (Excel 2013 only):

1. In a new workbook, insert an ActiveX command button on "Sheet1", no code required.

2. Run the following code

[Code] .....

3. Click on the command button.

4. Now click on any cell and try to enter a value.

Is your screen "frozen"? If so, go to another sheet, return to Sheet1 and try again. Does it work?

Here's an alternative code for MyTest() that causes no problems. Can spot the difference? Is there a reasonable explanation?

[Code] ....

Even more curious, call the following MyTest3 on Workbook_Open() and the workbook behaves. Run MyTest3 again and the screen starts freezing(!)

[Code] .....

View 3 Replies View Related

Excel 2013 :: Formatting Of Entire Worksheet Changes Unexpectedly

Jan 20, 2014

In Excel 2013 x64 (EN; CZ locale) I have this funny bug. I work on a large vba project and sometimes when I open it, every cell in every workbook that had default formatting now has this numberformat (shown as "Accounting")

"_-* #,##0.00 [$Kč-405]_-;-* #,##0.00 [$Kč-405]_-;_-* ""-""?? [$Kč-405]_-;_-@_-"

its seems that this formatting is assigned to styles --> Normal and it just messes up everything (pivots, slicers...) and cannot(!) be undone.

I have made some routines to check for this error on workbook.open and workbook.close and I also have file versioning. I check for the error regularly on every worksheet change, but it never comes up, nor does it whenever I close the workbook, so Im having hard time detecting when it occurs.

Sometimes when I try to open the workbook its just all messed up. When I go trough the versions, couple of them back still has the error which means it was already saved with it.

All I could figure out so far is that it sometimes happens when I try to copy some cell and paste it elsewhere (but later it works fine)

I'm 99.9% sure that my code is not causing it by accident or purpose. Now I just found the problem on different workbook that might have been opened at the same time. If you're interested, have a look here [URL] ......

View 2 Replies View Related

Excel 2013 :: Populate First Worksheet From Data Stored In Several Other Worksheets?

Feb 19, 2014

I have made a Rota of sorts using Excel 2013 Desktop Edition for my charities volunteers (and stored it as a shared file via office 365 server that they can download and edit) and this rota is populated by our volunteers manually. Each day our controller needs to check the file to see who is on duty at that time.

How the Rota is populated.(the bit i managed to do myself)

The volunteer (Person A in this example) would open the excel file and go to the month they wish to choose a shift for (ref worksheet: FEB in this example). They would then pick a shift that suits them and click on the cell (ref: F32) that shows a vehicle available, then from the drop down list they select their name and then save and close the sheet.

Rather than our volunteer controller going through the sheet for the current month (ref worksheet: Sheets JAN to DEC) I would like them to use the first sheet in the workbook (ref worksheet: DC Info Page) to get an instant view of which volunteer is currently on shift.

My current problem

I don’t know how to make the excel file do the following

Search sheets JAN to DEC (ref cells: C4:I58 on each sheet) inclusive for the cell that contains today's (current actual) dateCopy the 8 (eight) cells below the cell that contains today's datePaste the copied cells in to the relative cells (ref: C8 to C15) in sheet one (ref worksheet: DC Info page)

I would also like this to be done automatically so the controller does not have to click on anything after they open the file. But if it needs a button to process the request, one could be added to the worksheet (ref: DC Info Page)

View 1 Replies View Related

Excel 2013 :: Saving Large Multiple Worksheet File

Aug 11, 2014

I have an Excel file that's updated monthly. when it does save its around 16mb and can take up to 12 hours to save, and sometimes just doesn't.

I have tried saving as binary, I have made sure exact size of area to be saved is required, I have tried save with no calculations.

Basically the only reason I need to save it is so that another analysis spreadsheet can pull data from it. The file is heavily formatted, charts, vlookup tables etc, none of which is needed when analysis spreadsheet links to it.

View 1 Replies View Related

VBScript To Call Excel Macro - Loss Of Tab Functionality?

Aug 29, 2013

I am trying to open an Excel Workbook which in turn will automatically run a macro on loading which is a Userform. The Userform will contain 3 boxes, just some simple text boxes.

I don't want the Excel Workbook to show in the background, so I have opted to go for a VBScript to call the Excel Application and open the spreadsheet...

I have a current .vbs script which is as follows...

Code:
Option Explicit
On Error Resume Next
ExcelMacroExample

[Code]....

This works fine, there is no workbook showing and the userform opens as expected. The problem is, I lose the functionality to tab between the boxes. When opening the Userform directly in Excel,

View 1 Replies View Related

Excel 2013 :: Merging Selected Lines In Worksheet To One Line - Removing Dupes?

Aug 12, 2014

I merged about 15 adresslists from media contacts to one excel list. Each list had a name i.e. music, health, theater, etc. and the same logic in colums. I added a few columns and have 1 large list now.

As some journalists write about music & health & theater, architecture, etc. they are listed up to 10 times in the new list now. But the "genres" from the original list i.e. music, health, theater, etc. are in different columns. Some of the lines have empty fields (i.e. no address or mail)

All I want to do is have one line with all the information of all 10 lines in it, merged, dupes removed:

company - firstname - lastname - Adress - Mail, etc. : genre: music - health - theater:
example.xlsx

I atteched an example of the full list and the result i want

View 9 Replies View Related

Excel 2013 :: Named Formula Scoped To Workbook Are Duplicated On Worksheet Copy?

Jan 27, 2014

I'm using some workbook-scoped named formulas to define some dynamic ranges which will be referred to by numerous worksheets. The named ranges are defined like:

NAME: gTable_costDetailsEquipment
REFERS TO: =globalParameters!$B$5:INDEX(globalParameters!$B$5:$C$1048576,1+countAdjacentNonBlank
(globalParameters!$B$5,"down"),1+countAdjacentNonBlank(globalParameters!$B$5,"right"))

From either of the tabs "Reports" or "DOR_Template" the user can press the large "+" icon to add a report (which copies the template or the last report to a new sheet).

When this Sheet copy takes place, excel is repeating my named formulas - this time it's making LOCAL versions scoped to the newly made worksheet.

I've used this copy sheet trick before and have never had excel create new, locally scoped, named formula for each workbook level name.

I also just recently started using excel 2013, is this a problem with the new version? I've just never seen this problem, usually workbook-level names are NOT duplicated on sheet copy.

View 2 Replies View Related

Excel 2013 :: Copy Method Of Worksheet Class Failed (Runtime Error 1004)

May 17, 2014

I'm using Excel 2013 and I'm getting an issue in vba I can't figure out. (This is something I've done several dozen time before) But everytime I try to copy a sheet in a workbook,

Sheets("Sheet1").Copy After:=WB.Sheets(WB.Sheets.Count)

I recently copied in this sheet from another workbook, and deleted all of it's formula names, but I can't copy any other sheets now either.

The Run time Error 1004: Copy method of Worksheet Class failed pops up. What is weird is that I put in a msgbox and

MsgBox (WB.Sheets.Count)

returns a "1" though the sheet has about a dozen sheets within it. I've saved the workbook and even saved it as another name.

The sheet I imported has a sheet number of 77 while the previous last sheet was 23, could this be a cause?

View 2 Replies View Related

Excel 2013 :: Copy Entire Row If Cell Contains Specific Text And Paste Values Into Another Worksheet

Jun 23, 2014

I am using the code below in Excel 2013.

Sub Test()
For Each Cell In Sheets(1).Range("J:J")
If Cell.Value = "131125" Then

[Code]....

This works great except that it pastes formulas. I would like to paste values only. I've tried
" PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False" and it gives me an error.

View 3 Replies View Related

Asking To Unprotect An Unprotected Worksheet

Oct 9, 2009

I am working on a worksheet that has been protected off and on. I unprotected this AM, but XL will not allow changes and instructs to unprotect the WS, but it is already unprotected. The WB is not protected and never was. I am at a loss as to how to work around this problem.

View 9 Replies View Related

Protect / Unprotect Worksheet Before VBA Runs

Oct 26, 2011

I have a file that needs to be locked down so that the end user does not have the ability to enter data where they shouldn't. The end users are very Excel illiterate, and have proven that I need to have high security in place. Here is my current VBA code - the purpose of which is to hide/unhide rows depending on data entries. (Disclaimer: this code may not be pretty as I am a VBA rookie, and I've begged borrowed and stolen from about 10 other threads on this board to get where I am, and yes it works).

Code:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "C7" Then Call Changeto1
If Not Intersect(Range("c9"), Target) Is Nothing Then
Rows("15:44").EntireRow.Hidden = True
Rows("15:" & Range("c9").Value + 14).EntireRow.Hidden = False
End If

[Code]...

The question is now....how can I unprotect the sheet so that this code works without allowing them to enter data where they shouldn't. I've been at this for days already.

View 7 Replies View Related

Unprotect Worksheet Error 1004

Feb 22, 2007

Im currently trying to create a macro to protect and Unprotect a sheet.

I have gotten it to work fine with protecting and unprotecting the worksheet in question.

The only problem i have is if the incorrect password is entered when trying to unprotect the worksheet. I get a Error 1004 telling me the password is incorrect and to ether Debug or End the macro.

My question is. Is there any way i can stop this and instead show a message saying to reenter password ?

Current code i have is (please note that the if Err 1004 doesnt work as yet) :-

Private Sub TogAuditSheet_Click()
Dim strPassword As String
Dim strPasswordcheck As String
If TogAuditSheet.Value = True Then
strPassword = InputBox("Enter the password to Protect & Hide the Audit Findings Workheet")
Worksheets("Audit Findings").Protect Password:=strPassword, Scenarios:=True
TogAuditSheet.Caption = "Audit Findings Hidden. Click to UnProtect"
Sheets("Audit Findings").Visible = False
Else

View 9 Replies View Related

Unprotect Worksheet Macro With Password

Dec 31, 2004

Here is my macro, how do I add the password to make it work properly?

Sub unprotect()
' unprotect Macro
' Macro recorded 12/30/2004 by '

ActiveSheet.unprotect
ActiveWorkbook.unprotect
End Sub

Both the sheet and the workbook are protected and use the same password

jiuk - code tags added

View 4 Replies View Related

Drop Down Click To Unprotect Worksheet

Sep 4, 2007

I have a worksheet that is initially protected when a user views it. Certain cells are unlocked.
I have 46 drop down lists on the worksheet, of which none are locked so the users can access them for selections.
I want to unprotect the sheet when ANY of the dropdowns are clicked on.
For each change event I have the following
Sub DropDown34_Change()

Application.EnableEvents = False
ActiveSheet.Unprotect

However I still get the microsoft error screen showing up telling me that the cell is protected BEFORE it unprotects it and allows me to make changes.

View 9 Replies View Related

Creating Buttons To Protect/unprotect Worksheet

Jan 21, 2009

Create a button for protecting the worksheet and a button for unprotecting the worksheet

View 13 Replies View Related

Macro To Unprotect Sheet Unlock Cells And Protect Worksheet With Same Password

Jan 23, 2012

I have been really trying to get this sorted myself and I can get it to work with one exception. I can't get the sheet to lock with a password. It locks, but if I try to unlock it again, it does so without prompting me to enter a password.

Essentially I am wanting to unprotect two sheets, unlock the cells that were previously locked (so users couldn't enter data in them when the sheet is protected), then reapply the same password to protect the sheet, but now they will be able to enter data in the unlocked range of cells).

The second macro is to reverse the changes made in the first and 're-lock' the unlocked cells) (and again apply the same password to the sheet).

this is the code I have used.

Sub PART_YEAR()

Sheets("2012 Calculator 1 week").Select
ActiveSheet.Unprotect "taado"
Range("D20:D23").Select
Selection.Locked = False
Selection.FormulaHidden = False
Sheets("2012 Calculator 2 week").Select

[Code]...

I am assuming I have superfluous code in there, in addition to my mistake with the reapplication of the password.

View 3 Replies View Related

Unique Timestamp When New Worksheet Is Created

Oct 14, 2008

for my kind of business we start off with 1 worksheet that has the original plan. We name this sheet "R(0)"
Every time the plan is revised (modified) it is only done by first creating a new worksheet then saving the revisions there. When we create a new worksheet it is automatically named "R(1)" , as in Revision 1.

My request is the following;
i have placed cell number "D86" to reflect the unique date that the sheet is created, so that every time a revision is done when creating a new sheet, the idea is to have this cell automatically update, inorder to reflect the date & time the revision was created. So at the end of the week when you have 5 revisions (5 worksheets), each worksheet will reflect the unique date & time of the revision.

View 9 Replies View Related

Linking To A Worksheet That Hasnt Been Created

Feb 15, 2009

I'm not sure if this is possible. But here it goes. Here is how my spreadsheet stands. I have a sheet called "Dates." When I input a date into a cell it creates a copy of a template and titles it with the date (eg 2009.02.15). What I then need is for some of the cells of this newly created sheet to be linked to cells in other sheets in the workbook. These other sheets serve as databases so to speak and will collect, tabulate and analyze the data from the various sheets created for each day in the Date column. I hope that is clear.

I thought that by creating this Dates sheet I would be able to link the cells in the database sheets to the new sheets that will be created. When I tried this, however, it did not work. The sheets I want to link will have the name of the text that will be entered into the Dates cells. For example. If I put 2009.02.15 in A2 I will want the corresponding cell in my database sheet to have the formula =2009.02.15!C12. Is it possible to make this link before there is text entered in A2 and before the new sheets even are created. I have not been able to do so yet.

I was tryin to think of another way and I came up with this. Here is the code I use to create the new sheets.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim wsNew As Worksheet
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Sheets("experiment template").Select
Sheets("experiment template").Copy After:=Sheets(Sheets.Count)
ActiveWorkbook.Sheets("experiment template (2)").Tab.ColorIndex = 5
Sheets("experiment template (2)").Select
Sheets("experiment template (2)").Name = Target.Text
End If
End Sub

I was thinking it would be easy for this code to link the cells from the new sheet to the existing database. However, I then ran into a problem down the road. For each new sheet created (each new date entered) I want it to enter the values into the subsequent row in the database. Not keep on overwriting the same row. It seems as though there should be code for this but I am not sure how to do it.

View 9 Replies View Related

Before Double Click Event Of Worksheet Created By Program

Oct 19, 2007

My program(which is an add-in, or will be when I've finished writing it) creates a new worksheet called "Groups Summary" I would like this sheet to be locked so that the user can not modify anything on it. I would also like that if they double click a cell this will launch a userform if based on certain conditions.

I believe this code would have to go in the worksheet itself, so the question is how do I get the macro to enter code into a worksheet that it creates?

Is there a way to write it in a standard module and then automatically copy it when the worksheet is created?

View 10 Replies View Related

Created Named Ranges Referring To Wrong Worksheet

Aug 22, 2007

I have a FOR loop which is supposed to loop through all the worksheets in my workbook, create a named range, then add some data to the right of the range. However, when I run my code, all the named ranges refer to the last worksheet in my workbook. The loop only seems to be partly working, and I just can't work out why.

Sub maxLifData()
' for each worksheet in the workbook, do dmax formulae and add results to new sheet. bhole id on left, depth across top.
Dim ws As Worksheet
Dim wsName() As String
Dim i As Integer
Dim mCount As Integer
Dim nr1 As Range
Dim nr2 As Range
Dim head1 As String
Dim head2 As String
Dim wsRangeName() As String
Dim maxF As String
Dim fRange As Range
Dim rng As Range
Dim mRng As Range
head1 = "STCN_DPTH"
Set fRange = Range("G3")
Set mRng = Range("A2")
Redim wsName(Worksheets.Count)
Redim wsRangeName(Worksheets.Count).............

View 4 Replies View Related

Excel 2003 :: Unprotect And Protect Multiple Works Sheets With Macro?

Feb 25, 2008

I have an annual leave (vacation) work book with a summary page work sheet and separate work sheets for each month i.e. Jan, Feb, Mar.....to......Dec. In order to protect the formulas I have protected them by allowing only access to the input cells on each work sheet and the protect each work sheet.

When someone either joins or leaves the team I have to manually unprotect each sheet and protect again when I have completed the amendments to each of the 13 tabs.

macro code I would need to unprotect all the works sheets in one go (as I use the same password for all the sheets) and reset the passwords (protect) the sheets with more macro code.

I will be running the two macros from my own personal.xls file and ideally they would be fully automatic i.e. I would not need to input the passwords in to unlock or lock the work sheets as the password would be written in the code already

Excel version 2003

View 3 Replies View Related

Excel 2013 :: Mail Merging From Excel Database To Outlook

Apr 15, 2014

Using EXcel 2013, Windows 8

I have an Excel worksheet with one column being e-mail addresses. Other columns are Christian names, etc

Ideally can I create a full Mail merge with Outlook using whatever data I want. But probably just e-mail address and Christian name?

Otherwise be able to send one e-mail to all the e-mail addresses, without a major re-type.

View 2 Replies View Related

Put Formula In Userform Created In Excel

Aug 20, 2013

How to put a formula into my userform created in Excel.

What I have is 4 Combobox's which can select either 0,1,3 or 9 then each box has a weight which that number must be timed by this is the excel formula:

=SUM(L48*10,M48*10,N48*8,O48*6) so that was 9x10,3x10,9x8,3x6 Which gives me a sum of 210.

Can this be added to the userform so when the user selects the number from the dropdownbox it will calculate it into the total score?

This is a screen shot of the userform : Capture.JPG

View 4 Replies View Related

Excel 2010 :: How Many Sheets Can Be Created

Jul 26, 2013

How many sheets can be created in Excel 2010? Is it depend on memory PC or is any limit within Excel?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved