I have a sub that I have copied out of a previous workbook where it still works fine. In the previous workbook it was assigned to a button. Now I am trying just to do it as an automatic action when the workbook is closed
It will lock any cell within the specified range that is not blank then protect the worksheet, save the workbook then save a dated archive copy
When I pasted it in to a new workbook I changed the range to A1:AP49 and strFileName
Now when I run it now I get an Error 1004 - Unable to set the Locked property of the Range class.
On Debug this line is highlighted:- c.Locked = c.Value ""
The full code is:-
Private Sub Workbook_BeforeClose(Cancel As Boolean) ' ' Lock_cells Macro ' Macro compiled 10/26/2011 by G CARNCROSS
' Locks used cells, saves the workbook then saves a password protected copy with the days date in the file name then closes the workbook ' ' ActiveSheet.Unprotect Password:="SHES"[code].....
I am using this code (below) to hide certain rows or columns depending on what number is entered. Everything is working fine and I am at the point where I would like to share this excel sheet with others but I would like to lock certain cells so that others cannot alter the formulas. As soon as I lock the cells and then enter values into the unlocked cells, I get the "run-time error '1004': Unable to set the Hidden property of the Range class".
I am using excel 2010 x64.
Code: Private Sub Worksheet_Change(ByVal Target As Range)If Not Intersect(Target, Range("B3")) Is Nothing Then If Range("B3").Value = 0 Then Columns("G:P").EntireColumn.Hidden = True Else If Range("B3").Value = 1 Then Columns("H:P").EntireColumn.Hidden = True
I am opening the file through the GetOpenFilename method. I am facing an error in of the cases... Like say or example i try and open a file with the XYZ.xls...which is already open. the system generates a mess saying "reopening will cause any changes you made to be discarded. do you want to reopen XYZ.xls?"
if i click yes...it works fine by reopening the file but when i click to No...Runtime error 1004 comes:
"Method open of object workbooks failed "
and its giving an error here in the Workbooks.Open Filename:=sFilename ......
I am trying to adapt a macro to run on data that is consistently in the same format but the data does change, the macro needs to run over and over on new excel workbooks, dynamic range ? instead of a set source ?
Is there a limit on the amout of pictures you can use with the statement me.pictures.visible? Reason being, I am trying to import 119 pictures into a spreadsheet. When the information is selected form a drop down list, it pulls up the 1 of the 119 pictures. I was able to get 54 pictures input. Everything was going great until the 55th. When it stared giving me an error... ______________________________________________ Runtime Error '1004':
Unable to set the Visible property of the Pictures class ______________________________________________
When I select Debug, it takes me to the line with Me.Pictures.Visible = False
Everything seems to work fine until I enter the 55th picture. If it is that, is there a viable work around?
Getting a error message when opening a workbook "Runtime error 1004" I dont know much about excel and the user explained it to me as best she could . Here is where the script bugs:
When I run the following code it keeps giving me a runtime error 1004.
Code: Sub ImportData() Dim fNameAndPath As Variant Dim wb As Workbook Dim cNextRow As Long Dim Ans As String NextRow = ThisWorkbook.Worksheets("Errors").Range("B" & Rows.Count).End(xlUp).Row + 1 cNextRow = ThisWorkbook.Worksheets("Compare").Range("A" & Rows.Count).End(xlUp).Row + 1
I am converting Excel Templates which were developed in office 97 to Excel 2003.The templates are running fine in office 97 ,but when I run the same template in off 2003 I get the error "Run time Error Code 1004 : Application or Object Defined " and when I tried to debug the cursor is pointing to a cell which contains a formula which add multiple cell values.Can any one throw some light on this why the template which works fine on office 97 is not working in office 2003?
when I register the formula in the macro they work perfectly, when I run I receive this message, really do not know why I thought maybe I should substitute something but really is too complex for me to go inside that.
I wrote the below code, the error seems to be occurring on the ActiveSheet.Name line. At this line the debugger is giving the runtime error.
Sub ListWorkSheetNames() Dim Sheetnames Sheetnames = Sheets.Count Sheets.Add ActiveSheet.Name = 'SheetList' Sheets(SheetList).Move after:=Sheets(Sheetnames + 1) For i = 1 To Sheetnames Range(A & i) = Sheets(i).Name Next i End Sub
I used the formula from this website to do a vlookup for pictures www.mcgimpsey.com/excel/lookuppics.html
It was working great then I seem to have a problem currently I have 58 pictures on the spreadsheet and when I add the next one I keep on getting an error
Error reads
Runtime error 1004 Unable to set the picture property of the picture class
I am getting an Run Time error 1004 Application-defined or object defined-error.
I am assuming this is occuring because the username is not in the list for the pivot table as I am using some code which includes Environ, some code that if user name is not in pivot table then bring back no data or make pivot table blank. I have included the code below.
I've just recently ran into this Error (Runtime error 1004) "Too many different formats." I'll admit i have a ton of cell formats within my single worksheet. perhaps most are for artistic purposes.
Still, my worksheet as it is causes this error, when running my scripts. When I wipe out all my format color, boarders, etc. my scripts run fine. Is there a maximum amount of cell formats that can be used? I'm using Excel 2003
Is there a way to circumvent this?. Not sure if using Excel 2007 is an option: I've tried opening my project in 2007, but found that all my buttons were missing, plus it seemed to run considerably slower.
Here is the data I am working with. On another sheet, I want to count the number of entries on Total requests sheet if Column M - Closed < Column Q - End Date. There is other criteria and I have this, which doesn't work: Run-time error '1004' Application defined or object defined error. I think it is due to the part where I'm working with the dates...
I am trying to protect cells & password protect my workbook on closing. Here is my code. Not only is the cell locking code not working, but it is also preventing the code from re-hiding the columns ("P:P,R:R,W:W,U:U,AA:AA"). Here is my code; I've tested it on a blank sheet & it was working:
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.ScreenUpdating = False Application.EnableEvents = False
I want the code to determine if the cell before and after the active cell contains a value and if both these conditions are true to delete the active row.
I keep getting a runtime error 1004 when I try this...
I'm currently trying to make a script that will cut invoices out of several finance workbooks, I have ommitted the main part of the processing as it happens later and does not have any bearing on this problem.
When it reaches the line I have marked, it breaks with the error "Runtime error '1004': Select method of worksheet class failed". I'm fairly sure the problem lies with the Workbook but at the time of break WbZ is set to a valid workbook (FinanceSheet_SP_Thomas.xls in this case) and the workbook contains a sheet called "Invoice Sheet".
worked at one point but now gives a '1004' runtime error. What I am trying to accomplish is have the user display a line of data on a userform, modify it, then write it back to another sheet in the workbook.
I manage to find a macro online, which aims to insert a desired formula into desired cell range. However, when I execute the macro, i get a "run-time error, 1004".
i have this code for copying diffrent ranges of cells and saving it in different workbooks:
Sub NewCopy() Dim strFileName As String Dim range1 As Range Dim rng1 As Range, rng2 As Range, myMultiRanges As Range
[Code].....
the problem is when is share the workbook, it generated the runtime error '1004' Command is not available in a shared workbook... make it work even in a shared workbook.
I currently have a list of companies. I want to create a unique list of these companies which I can use for some irrelevant purpose. What i did was I started recording a macro in which I first deleted everything in the spreadsheet. Afterwards I copied the whole company list from another spreadsheet and pasted it as values into the new spreadsheet. Afterwards I made an advanced filter; list range being the companies and copied it into a new location after making sure I had said yes to unique only.