Run-time Error '1004': "Unable To Get The Buttons Property Of The Worksheet Class
Feb 24, 2010
I am getting the following error when i am clicking a Button on sheet1 which is generating duplicate of sheet1.I am trying to delete the button when duplicate is created..Error is:" run-time error '1004' Unable to get the buttons property of the worksheet class" at this line in code"ActiveSheet.Buttons("CmdHistory").Delete"
View 2 Replies
ADVERTISEMENT
Jul 10, 2014
I use Excel 2010 andexample.xlsx cannot make my code working because of the so famous errore above.
I have several pivot tables (pt) in different worksheets (ws), and a list of items stored in an array I created. I've written a macro for setting ON all items in pt except those ones in the array (listOffnet within the code). Everything works properly.
Now, I would like to do the complementary action: setting OFF all items that are not in the array. Unfortunately, I get the error at line:
[Code]....
View 1 Replies
View Related
Jun 25, 2013
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
[code]....
View 3 Replies
View Related
Jul 18, 2007
I've noticed error 1004 is very broad and switches its name depending on what you're working with. But I have no idea what it means.
This is the line w/ probs:
Sheeti.Cells(y, 2).Value = WorksheetFunction.DGet(InventoryRange, 3, CriteriaRange)
I looked at protection and Macro security and checked my definitions (that work in other contexts).
Does DGET need to have criteria and database in the same worksheet? My project is working between two workbooks.
View 6 Replies
View Related
Dec 28, 2009
i am getting a run time error 1004 Delete method of worksheet class failed,
ws.Delete
Sub Save()
Dim myName As String, myFolder As String, e
Dim fso As Object, temp As String
ThisWorkbook.Save
Set fso = CreateObject("Scripting.FileSystemObject")
myFolder = "C:UsersRecsDocumentsTestVBA & ExcelEmail_Files_Temp" & Year(Date) & "" & Format$(Date, "mmm")
For Each e In Split(myFolder, "")
temp = temp & IIf(temp = "", "", "") & e
If fso.FolderExists(temp) = False Then fso.CreateFolder (temp)
View 9 Replies
View Related
Jan 6, 2009
I've been using the following code successfully for years. Today I would get the error 1004:Unable to set the visible property of the worksheet class. All my searches came up with someone not realizing they had protected the workbook. As you can see, the first thing I do before trying to set the worksheet visible is to unprotect the workbook. In frustration and on a lark I tried .Sheets("items").Visible = True and it worked. These kind of intermittent errors in Excel VBA are very frustrating. Can anyone tell me what I am doing wrong?
View 6 Replies
View Related
Jul 3, 2014
I have been working on this small project and I it works to create checkboxes and check what boxes are checked. However, at the end of checking which boxes are checked there is a pop up error message saying Run-Time error '1004': Unable to get the CheckBoxes property of the Worksheet class. These are the lines of code, where is the error?
Sub IsBoxChecked()
Dim titles(200) As String
Dim wks As Worksheet
[Code]....
View 5 Replies
View Related
Jan 19, 2009
Here is the code that generates the error:
Set rng = Range("I:I")
LR = ActiveSheet.Cells(Rows.count, "I").End(xlUp).Row + 2
Range("I" & LR).Value = Application.WorksheetFunction.Sum(rng)
Range("I" & LR).NumberFormat = "#,##0"
and from what I've read on google the .SUM(rng) need to be set to a range, but isn't it already a range? I tried plugging in there Range("I:I") for rng and that didn't work either.
View 9 Replies
View Related
Oct 27, 2011
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].....
View 2 Replies
View Related
Feb 1, 2012
The vlookup worked earlier but now it doesn't and everything looks OK to me. Scroll down a little bit in the code view to see the error line.
HTML Code:
Sub Email_Executed()
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
[Code]...
View 6 Replies
View Related
Feb 16, 2009
I am using the "Find" in VBA and wanted to test if the value searched for could not be found.
So I get the
error = "Unable to get the find property of the worksheet function class"
When the text cannot be found.
Dim zz As Variant
zz = Application.WorksheetFunction.Find("xx", "Hello", 1)
I also tried
Dim xx as boolean
xx = Application.WorksheetFunction.IsError(Application.WorksheetFunction.Find("xx", "Hello", 10))
But this produced the same error.
View 9 Replies
View Related
Jan 23, 2007
TotHCInv.Value = WorksheetFunction. Sum(KRInv, PBLInv, CRInv, PVInv)
If i >= 34 Then CPSCtphRMA.Value = WorksheetFunction.Average("G" & (i - 30) & ":G" & i)
The first line runs properly, but the second line bugs out with the error message "Unable to get the Average property of the WorksheetFunction class". I can simply do the math, but I thought that using the worksheet function would be easier than summing and dividing. I'm curious, though, as to why I can't seem to use the Average function.
View 3 Replies
View Related
Dec 26, 2013
I am having problems with some vba codes when I protect my workbook; 'I get an run-time error 1004 Unable to set visible property of the worksheet class'
The code I am trying is:
Sub Stats1_Return_TextBox1_Click()
ActiveSheet.Unprotect "meme"
Application.Goto Worksheets("BCM Database").Range("L15")
Sheets("Stats 1").Visible = False
ActiveSheet.Protect "meme"
End Sub
How to sort this. One more question is there away of protecting you vba code? stop users being able to view or edit them for instance?
View 4 Replies
View Related
Apr 14, 2007
Having problems with trying to get my vba code to access the SpecialCells property. Receiving the following error.... Unable to get the SpecialCells property of the Range class. The section of my code is below that is causing the error. Keeps stopping on the "Selection.SpecialCells(xlsCellTypeVisible).Select" line.
Sheets(" Book Query").Range("A6:I6").Select
Sheets("Book Query").Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlsCellTypeVisible).Select
Selection.Copy
Sheets("Inventories and Variances").Select
Sheets("Inventories and Variances").Range("A7").Select
View 2 Replies
View Related
Aug 15, 2006
I have created quite a nice little macro that;
drills through a lot of key figures, updates a pivot chart and copies the chart to powerpoint.
However it crashes on one particular data set every time with this error:
Run-time error '1004':
Unable to set the _Default property of the pivot item class
The code where the debugger stops is the last line below here.
lngKpi = Sheets("Helpfile"). Cells(lngRow, 2)
Sheets("Charts").Select
ActiveSheet.ChartObjects("DK").Activate
ActiveChart.PivotLayout.PivotTable.PivotFields("KPI # (overall").CurrentPage = lngKpi
I can manually change the pivot chart to the keyfigure it crashes on and thereby workaround the problem in the macro. Also it works for more than 50 other keyfigures without problems.
View 9 Replies
View Related
Apr 26, 2006
I am receiving the error "unable to get the find property of the range class" in my code. I have attached my code and highlighted red where my error is occuring.
On Error Goto ProductionRptEngineListExport_Error
Dim objWrkTmp As Excel.Workbook
Dim ObjWrkshtActive As Excel.Worksheet
Dim objWrkshtTmp As Excel.Worksheet
Dim RngStart As Excel.Range
Dim CurrentRowNum As Long, RowCnt As Long
Dim GroupRowNum As Long, ColCnt As Long
Dim chtChart As Excel. chart
Dim intwrktmp As Integer, intwrktmpTot As Integer, intLastRow As Long
Dim sngwrk As Single
ctlStatus = "Opening Production Report..."
DoEvents........................................
View 2 Replies
View Related
May 22, 2009
I cant get this code to run more than one time and when it does run it doesnt reset the password protection back on and it fails to complete all instructions.
I get a Run time error '1004'.
Unable to get the CheckBoxes property of the worksheet class
View 2 Replies
View Related
Oct 20, 2008
I lost 2 days trying to discover the bug in my program, but I coudn't find the right answer.
How can I activate the AutoFilter to show me the rows selected with "YES" ?
This is the code... The compiler stops always at the command Selection.AutoFilter.
View 14 Replies
View Related
Oct 16, 2009
This very simple macro in Personal.xlsb is driving me crazy!
I want to paste a previously selected and copied range at the current position as values. The range will seldom be the same as previously, and the position where it will be posted will be random too.
The code is: ...
View 13 Replies
View Related
Oct 26, 2009
I found the following code on your forum, but get the following error:
Run time error '1004'. Autofill method of Range class failed.
The error occurs when the spreadsheet either have 1 row of data completed or no data, can I get code to ignore the autofill when I only have 1 row or no rows completed in various spreadsheets. I have attached a copy of the spreadsheet.
View 2 Replies
View Related
Feb 17, 2010
I am trying to autofill a range of cells in column L (12). I first copy the formula and add an equal to (=) sign to it. then this is copied to cell L14 (The first cell of the intended range).
After this I find out the last filled row (using FOR loop and a counter 'c').
After this I use the Autofill option but I get an error.
Run time Error '1004':
Autofill methodof Range class failed
View 2 Replies
View Related
Jul 1, 2008
This file has been running just fine....
But now I got this
Run Time error '1004':
PasteSpecial method of Range Class failed.
View 9 Replies
View Related
Jul 28, 2006
I have a userform that allows the user to view, modify or delete individual records (rows) of a worksheet in a workbook. If a particular item in a record is modified, a check occurs to ensure that the values for that item remain unique. All of that works exactly the way I need. The breakdown occurs when the records are then autosorted by a the values in a particular column. After the autosort, another column of values is copied and pasted to a different worksheet within the same workbook. For this to work properly, I must have the userform open along with the worksheet containing the records. If the userform is open with any other worksheet open, I get the following VBA error message "Run-time Error '1004' : Slect method of Range class failed". I need to be able to open the userform with any worksheet active and not experience this error when the autosort, copy/paste occurs. This is the code for the user form, the module for autosort, copy/paste and checking for unue values.
This is the sub in the worksheet with the records
'This checks for unique values
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim LLoop As Integer
Dim LTestLoop As Integer
Dim Lrows As Integer
Dim LRange As String
Dim LChangedValue As String
Dim LTestValue As String
Dim smessage As String
'Test first 7 rows in spreadsheet for uniqueness
Lrows = 8
LLoop = 2
'Check first 7 rows in spreadsheet
While LLoop <= Lrows.........................
View 3 Replies
View Related
Apr 7, 2007
I get the following error: Run-time error '1004': Select method of Range class failed at the following code line:
Worksheets("Sheet1").Range("A6").Select
View 4 Replies
View Related
May 22, 2007
I am using the following code and I'm getting a Run-time error '1004' error. When I reconstruct the macro one line at a time and run the macro between adding each new line - no error. After reconstructing the macro in its entirety, I can run it once with no error. However, if I try to run it again immediately after that, I get the error and I keep getting the error every time I run it from there on. I dont understand how it can work once and then stop working. Here is the full
Sub MoveToRoster()
ActiveSheet. Unprotect
Dim item As Long
Dim myString1 As String
Dim myString2 As String
Dim myString3 As String
item = InputBox("Please Confirm The Row Number Of The Child To Be Moved To The Roster.")
myString1 = "c" & item & ":e" & item
myString2 = "g" & item & ":n" & item
myString3 = "c" & item & ":e" & item & ",g" & item & ":p" & item ..........................
View 2 Replies
View Related
Jul 31, 2007
I am trying to filter and copy from masterlist to wholesalecertified. The data is actually pasted to WholesaleCertified, however, I got error 1004.
Sub Refresh()
With Application
.ScreenUpdating = False
.DisplayAlerts = False
Sheets("WholesaleCertified").Select
Cells.Select
Selection.ClearContents
Sheets("MasterList").Select................
View 9 Replies
View Related
Jan 6, 2007
I am getting the following error: Run-time Error '1004': Copy method of Worksheet class failed. after adding 53 worksheets to a workbook using VBA. I found several posts concerning this error in the forum. However, I did not find any responses that address the root cause or provide a solution.
View 3 Replies
View Related
Aug 19, 2009
Newcomer to Excel 2007 but long time programmer for Excel 2003. I am having problems with code that I feel should work. Code fails at the Select command with a "Run-time error '1004': Select method of Range class failed:
View 3 Replies
View Related
Mar 19, 2014
I locked the cells on Sheet1 from B4 to B10.
I protect the Sheet1 Review > protect sheet and selected two checkboxes from protect sheet property "Select locked Cell" and "Select unlocked cells".
It is working fine and it does not allow the user to view the locked cells B17:B24 while protection is on.
I have a RadioButton1 on the same Sheet1 and i put the following code behind the button to hide the 4 up to 10 rows. When i will press the button while password protection is on; it is giving me the following error:
Unable to set the Hidden property of the Range class.
View 7 Replies
View Related
Jun 26, 2009
I keep getting that error when I'm running my macro. When I debug, it points me to the bolded line in the code below. The larger macro I'm running this function in runs this function some 101 times without error before this happens.
The values of the parameters are as follows when it gives me the error:
Find_Exact("hchen", ws1, "B:B"). The first parameter is the only one that changes in the previously mentioned running of this function.
View 4 Replies
View Related