Hiding Columns: Unable To Set The Hidden Property Of The Range Class
I have recently tried to implement the password protect from viewing code from this site. It worked brilliant on a basic spreadsheet, but when I tried to implement it on a worksheet with links I keep getting the error:
Run-time error '1004'
Unable to set the hidden property of the Range class
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Unable To Set The Locked Property Of The Range Class
I am using the below code to unloock certain columns based upon a value in cell a1. The value is the previosu month end date. It was working, but now I am getting " run-time error 1004 Unable to set the locked property of the range class" Can anyone help me to fix the error. Sub UnlockMe() Dim cl As Range ActiveSheet. Unprotect "password" For Each cl In Range("$B$1:$M$1") If cl = [a1] Then cl.EntireColumn.Locked = False cl.EntireColumn.Interior.ColorIndex = 6 Else cl.EntireColumn.Locked = True cl.EntireColumn.Interior.ColorIndex = xlNone End If Next cl ActiveSheet.Protect "password" End Sub
View Replies!
View Related
Unable To Set The Xvalues Property Of The Series Class
For the last day I have been getting the following error: "Run-time error '1004': Unable to set the Xvalues property of the series class." The archetecture of the marco is sound being that I have used this methology in another macro and it works correctly every time. The XValuesand Values range are also correct and I know this because I had the macro select the data cells and it does this correctly as well. The data for simplicity at the moment has no empty cells or abnormal data. The data cells are all filled with some kind of data. For the XValue Range the data would look something like "2070087 4/27/2007" and the Values range is filled with a number between 0 and 100. What I can't figure out is why it crashes with a valid establish range. I highlighted the lines it crashes on in read, they are near the bottom. Sub Proto1() ' ' Proto1 Macro ' Macro recorded 8/30/2007 by aaron.verellen ' ' Dim CurrentSheet As String, ChartName As String Dim RowCount As Integer, ColumnCount As Integer, FirstColumn As Integer, LastColumn, _ FirstRow As Integer, LastRow As Integer, Row As Integer, Column As Integer, _ ProductColumn As Integer, ArrayIndex As Integer, ParameterCount As Integer, _ ItemCount As Integer, MyIndex As Integer Dim UserProductFlag As Boolean, NewProductFlag As Boolean Dim Possibilities() As String Dim ProductXRange As Range, ProductYRange As Range .................
View Replies!
View Related
Unable To Set The Visible Property Of The Worksheet Class
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 Replies!
View Related
Unable To Set The Formula Property Of The Series Class
I am struggling with one problem. I am trying to change formulae of series in a chart using VBA code given below. But I am getting 'Runtime Error 1004, Unable to set the formula property of the series class' ActiveChart.SeriesCollection(1).Formula = _ Replace(ActiveChart.SeriesCollection(1).Formula, "Sheet1", "test")
View Replies!
View Related
Unable To Set ColorIndex Property Of Interior Class: Fill Cell Color Macro
I have an error message that says: Run time error '1004': Unable to set the colorIndex property of the interior class. I attached code for your reference. If (Range("B10").Value = "Gift" Or Range("B10").Value = "Entertainment") And Range("C10").Value = "" Then Range("C10").Interior.ColorIndex = 6 MsgBox "Please Fill in the Person's Name & Company." Range("C10").Select Range("C10").Interior.ColorIndex = 6 End If
View Replies!
View Related
Unable To The Locked Property Of The Range Class
Sheets("PRODUCTIVITY").Select Range("A20").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlDown)).Select With Selection .Locked = False (***debug screen is highlighting this line***) .FormulaHidden = False .ClearContents End With Range("A20").Select ActiveCell.FormulaR1C1 = "PASTE NEW DATA HERE" Range("A20").Select This worksheet was built for use of many users so this sheet is PROTECTED. The user is instructed to copy/paste information from our internal web into the selected areas in the worksheet. When i UNPROTECT the worksheet the VBA works fine. The data in the worksheet spans from columns A to P, and the length (# of records) is variable.
View Replies!
View Related
Unable To Get The FindNext Property Of The Range Class
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 Replies!
View Related
Unable To Get The Find Property Of The Range Class?
When I try and run my macro I keep getting an error message saying Unable to get the Find Property of the Range Class and it refers me to: TeamRef = Worksheets("Info Reference").Range("A3:A120").Find(What:=strFind1, After:=Worksheets("Info Reference"), _ LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Address
View Replies!
View Related
Pivot Chart Error: Unable To Set The _Default Property Of The Pivot Item Class
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 Replies!
View Related
Specialcells Property Error "Unable To Get The SpecialCells Property Of The Range Class"
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 Replies!
View Related
Receiving Error In Code "unable To Get The Find Property Of The Range Class"
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 Replies!
View Related
Unable To Get The VLookup Property Of The WorksheetFunction Class...
I am trying to look at column at of two different workBOOKS and then when a match is found take the value from column D in workbook two and copy it to the corresponding row in the current column of workbook one. this is the code I'm using and I get that unable to get the vlookup function. I thought maybe it was because not all of them will have matches so it could return an error if it is trying to return empty, so I put int on error resume next, and it ran through but never brought over ANY data, and there ARE matches and data to be brought over. destRng is the range in the current column(that i just inserted) on the active worksheet that we will be putting the new info into. srcRng is the range in column A on the other workbook that the numbers are being compared to. src is just an integer
View Replies!
View Related
Unable To Get The Correl Property Of The Worksheetfunction Class
I get the "Unable to get the Correl Property of the worksheetfunction class" Error when I try to run the following code CurrentRow = 2 CurrentColumn = 2 Finalrow = 5 WS2 = Sheet2 Finalrow2 = 5 Num_Records = 4 Correlation1 = Application.WorksheetFunction.Correl(Range(Cells(CurrentRow, CurrentColumn) & ":" & Cells(Finalrow, CurrentColumn)), WS2.Range("B" & Finalrow2 - Num_Records + 1 & ":B" & Finalrow2
View Replies!
View Related
Unable To Get The Vlookup Property Of The WorksheetFunction Class ..
I have a UserForm with one ComboBox and one TextBox. The ComboBox is populated from another sheet with product codes in Col A and names in Col B. When the user selects a product code from the ComboBox the respective name appears in the adjacent TextBox. Once both boxes have been filled the user can then save the data to a third sheet. Now the problem arises when the user tries to manually enter a code into the ComboBox that does not appear in its rowsource - VBA states a run-time error and my new keyboard goes flying out the window again. Attached is an example sheet
View Replies!
View Related
Unable To Get The Find Property Of The Worksheet Function Class
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 Replies!
View Related
Unable To Get The Sum Property Of The Worksheet Function Class
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 Replies!
View Related
Unable To Set Formula Property Of Series
I went through a lot of threads in this forum, although there were a couple relating to the same problem am facing, they didnt solve my error .. so here's my question again .. When am trying to delink charts , i get an error stating "Unable to set the formula property of series class". The code is as follows : Sub DelinkChartData() Dim iCtr As Integer, iChars As Integer, SH As Shape, iPlotOrder As Integer Dim nPts As Long, iPts As Long 'Holds the total no of points in the chart Dim xArray, yArray, sChtName As String, sSrsName As String Dim xVals, yVals Dim ChtSeries As Series ' var used to loop thru the series collection Dim ws As Worksheet Dim sChartType As String, iCtr1 As Integer
View Replies!
View Related
Unable To Set The Orientation Property Of The PivotField
I want the data field to change to a different field when a command button (cmd_view) is clicked. So when the command button has a caption of "Toggle to Feeds", the code changes the field from Sqm to Feeds, and changes the caprion on the command button to "Toggle to Sqm". When this is next clicked, the fields are swithed over, and the command button caption changes relative to it. The code I have written is below: The problem I have is when the code changes the view from feeds to Sqm, it works fine, but when the code changes from Sqm to feeds, it crashes out in the true part of the If statement on the code line ".orientation = xlhidden" with the error "Unable to set the Orientation property of the PivotField class". As the code for the change of view is the same, apart from the field names, I am at a loss on what is the cause. I have tried to record a macro to see if the field names appear differently, but they do not. Sub Tog_pivot() Dim Toggle As String Application.ScreenUpdating = False Toggle = Sheet5.cmd_View.Caption If Toggle = "Toggle to Feeds" Then 'switch view from Sqm to Feeds Range("F12").Select ' hide existing field With ActiveSheet.PivotTables("Pivot_forecast_old").PivotFields("Sum of Sqm") .Orientation = xlHidden End With ' Create & display new field "Feeds"......................
View Replies!
View Related
Class With Property As Collection Of Another Class
I've created a class called CStock. It has 5 standard properties (with Get/Let methods) as explained in that article above. Nothing fancy here. I also want to create a CPortfolio class that has 3 properties: pName, pNumberofPositions, and pHoldings. the first 2 are stardard, but the last one is different. I want it to somehow keep a collection of stocks.
View Replies!
View Related
Unable To Get The Match Property Of The Worksheet Function
I'm trying to find the occurence of a date in a range. Here is the code I'm using: Windows(todaydate1).Activate For Each cell In range(Cells(top73, 3), Cells(bot73, 3)) z3 = DateSerial(Year(cell), Month(cell), Day(cell)) Windows("Cash Flow " & todaydate & " PM.xls").Activate Sheets("Commitments").Activate However the code stops right on the q3 line where the match function is located. The problem is that I'm getting a Run Time Error 1004: "Unable to get the match property of the worksheet function class" This would lead me to believe that the match function is not working. However, in Excel, it does work. Even when using the cell from the other Workbook, it works. All the dates which appear to be dates are indeed formatted as dates. The range is good. I've used the immediate window to verify the address and the values of the other variables in play. ?range(Cells(toprw, 2), Cells(botrw, 2)).Address $B$26:$B$49 Since the correct workbook and sheet is activated, I'm really at a loss here. Below is what the sheet looks like:
View Replies!
View Related
Sum Property Of The Worksheet Function Class
work around the sum error? Runtime Error '1004' unable to locate the sum property of the worksheetfunction class Public Function CalcSheet() Dim NoSales(0 To 11) As Range Dim DriveOffs(0 To 11) As Range Dim Voids(0 To 11) As Range Dim Shortages(0 To 11) As Range Dim tNoSales As Integer Dim tDriveOffs As Currency Dim tVoids As Currency Dim tShortages As Currency Dim X As Integer Dim NSc As Integer Dim DOc As Integer Dim VOc As Integer Dim SHc As Integer Dim aNoSales As Integer Dim aDriveOffs As Currency Dim aVoids As Currency Dim aShortages As Currency
View Replies!
View Related
Error 1004 Dget Property From Worksheet Function Class
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 Replies!
View Related
Save File With Hidden Property
I have an excel file which is in windows explorer has its property set to hidden. I have another excel file, with some Vba in it, which opens the hidden file, inserts some data into it, saves the file and closes it. ActiveWorkbook.Save ActiveWorkbook.Close This all works, except that the hidden property is lost in the process. Is there a way of saving the file, and keeping the hidden property? This is just so that users cant see the file and accidently open it.
View Replies!
View Related
Unable To Use Arrow Keys To Select Hidden Cells On A Protected Workbook
I have a problem with a spreadsheet I am working on, and I'm not sure if its something I've done, or whether its corrupted. Basically, Column A is Hidden and not Locked in the protection tab of formatting. The other columns are Locked and not Hidden. I used to be able to use the arrow keys to scroll through Column A, but this now doesn't seem to work. I can select the cells within column A with the mouse and I can scroll with the mouse and the scroll bars, but I can't move between the cells with the arrow keys, enter button or tab button. Does anyone know what might be causing this, or is the workbook corrupt?
View Replies!
View Related
ComboBox Error "Could Not Get The List Property - Invalid Property Array Index" When Typing Out Of Range
I have a form with several combo boxes, and they function just the way I like as far as being able to pick from the list, or typing in them and having it show you the next available item in the list as you add letters. Whats happening that I would like to know how to deal with is... as soon as you type a letter that is not in my lookup range it generates an error. "Could not get the list property - Invalid property array index". I don't want people to be able to add to the list, but I would like a msgbox to pop up. Then allow them to go back to the box and try again.
View Replies!
View Related
Cannot Set Listindex Property!
For some reason my selection won't return to where it's supposed to in a listbox after I've increased it's column widths. It's very strange. I've put together an example of the issue as the actual workbook is enormous, but the demonstration seems to work. I've tried exporting the Listindex resetting code to an external function, but it didn't help either. Can anyone understand this behaviour?
View Replies!
View Related
Set Control Visibility Based On Tag Property
I have a userform which uses the tag property of the frame to determine whether a frame is visible (and hence the controls that reside within the frame). A frame contains three combo boxes, and six text boxes. The tag property of the frame matches the number of frames that are visible on the form, so that if the user selects five frames, frames 1 through five become visible and for all other frames visible = false. A frame contains all the data for a single entry. There can be up to fifty frames/ entries that are visible on the form depending on the user selection. I want to use the visibility property to do two things: first the combo boxes are filled from an array after the user selects the number of frames (or entries). I only want to fill the comboboxes where the frame is visible. The second thing is that I have a function which uses the data from the text boxes and combo boxes as required arguments. Since these are required arguments, I will get a data mismatch error if I try to call it and the controls are empty. Therefore, I only want to call the function if the frame which houses the controls is visible. Public Sub Visible1(Entry As String) Dim ctrl As Control For Each ctrl In UserForm2.Controls If TypeName(ctrl) = "Frame" And ctrl.Tag <= Entry Then With ctrl .Visible = True End With Else If TypeName(ctrl) = "Frame" And ctrl.Tag > Entry Then With ctrl .Visible = False.............
View Replies!
View Related
Set Variable To Forms Control & Get Value Property
How do I reference a spin button from a variable that I set. e.g Dim objSpn As Object Dim y As Integer Set objSpn = ActiveSheet.Shapes("spnWCDate") y = objSpn.Value This doesn't work, but hope it explains what I want. It's so I dont have to write the whole object name each time I reference it. ADDED: I've just noticed that this doesn't work even i do reference the object with the full name. I copied this from a forms spin control that I was using, why can't i store the value of the spin button in a variable?
View Replies!
View Related
Set XValues For Series Class (Chart)
I'm getting an error when I try to set the XValues for a chart in my excel worksheet. The chart shows up fine and the new series adds fine though when I try to set the XValues the below error occurs 'Unable to set the Xvalues property of the Series Class' 1004. My Code is below. Can anyone see anything wrong with it? This could be a floor in my understanding of the chart object. I don't want to be selecting charts and working on an activechart because I'll have several in the one worksheet.
View Replies!
View Related
Set Focus To Application After Hiding UserForm
I created UserForm with one TextBox and "Close" Button. And it's works like a real-time search with my criteria. He is using AutoFilter to show what he found. And when I'm pressing Close Button the Focus isn't on Application, but on Hidden window (know because when I'm clicking alt+space form's menu shows). To show window I'm using (running from hot-key): DoCmd.OpenForm "UserForm1" to hide Private Sub CloseButton_Click() UserForm1.Hide End Sub
View Replies!
View Related
Unable To Display Cell Value When Cell Is Hidden
I found some code that is working great, but I'd like to add some functionality to it if it can be done. When a cell is clicked in Column G it is displaying a % found in Column F in the same row as G under the cell similar to a comment without using the comments option. The problem I'm finding though is that if Column F is hidden then it is not displaying the results in the cell found in Column G. Here is the Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Row As Integer Dim Amount As String Row = ActiveCell.Row Amount = Range("F" & Row).Text Basically I'd like to know if it is possible to show the comment in G if the Cell it is trying to reference is hidden.
View Replies!
View Related
Hiding Sheets But Still Letting Macros Run When Printing Hidden Sheets
i have a workbook that has the following sheets working sheet job sheet receipt of deposit letter completion sheet delivery note delivery note (2) odd even t&t glass ggf i want to hide every sheet except the working sheet. I have tried this but the macros bring up an error when i run the macro my macros involve printing certain pages dependng on what button is pressed i get an error whatever how do i stop this
View Replies!
View Related
Macro To Set Print Area W/o Hidden Rows
We run a small gardening shop and use a simple spreadsheet to track of various things. Row A contains headers, with the data following in the rows underneath. This table is now quite large, and we therefore hide 600 or so rows so that only rows with data from the last week is shown. We often need to print this for easy reference. I currently do this by highlighting the area I want and setting it as print area. The print therefore doesn't include hidden cells, which is what I need. The problem we have, therefore, is that we have to manually select this print area each time. My experience with macros is VERY limited, to the point where I can record one which will select the print area and print. However, as the list gets longer and more rows are hidden the range obviously needs to change, and my simple macro will not keep up. So my question is as follows. Is there a simple macro I could write to assign to a button that could "keep up" with the moving range? So either it always prints the header row and the, for example, 50 rows beneath (exlcuding the hidden ones), or, even better, it prints the header row and all rows with data in them that are relevant to the last week. Each row has a cell for the date it concerns so assume this may be possible?
View Replies!
View Related
Unable To Hide Columns/delete Values Using Combo Box
Using two Combo Boxes, I am trying to create an drop down outline form input sheet. What it does is if you select the first selection in the combo box 1, then it hides certain rows, and deletes certain cells. If you select the second option in the combo box 1, it shows another combo box (2) which has another list of categories. When I select the option 2 on the combo box 1, it unhides a bunch of rows, and activates combo box 2. However, when I try to select categories on combo box 2, each time it tries to hide/unhide rows I get this message "Unable to set the hidden property of the range class." I have no idea whats going on. Here is my ....
View Replies!
View Related
Hiding / Showing Columns ....
Here's what I'm trying to do - There's a sheet called "Main" and 38 other sheets that shows the data (these 38 sheets all have the exact same structure/layout). Let's say these 38 sheets are called "country1", "country2", .... "country38". Based on user input in cell J10 in "Main", I want to show only the relevant columns in all of the 38 country sheets. Specifically, If J10 in sheet "Main" = "Option 1", hide all columns in all 38 sheets except columns A to W. If J10 in sheet "Main" = "Option 2", hide all columns in all 38 sheets except columns Y to AU. If J10 in sheet "Main" = "Option 3", hide all columns in all 38 sheets except columns AW to BS. If J10 in sheet "Main" = "Option 4", hide all columns in all 38 sheets except columns BV to CQ. If J10 sheet "Main = "ShowAll", show all columns in all 38 sheets.... Cell J10 in "Main" will be a drop down bar with the 5 choices.....
View Replies!
View Related
Hiding / Unhiding Columns
I have a spreadsheet that i would like to hide all columns from B:M and to select the column/s I want to unhide. I would like VBA cose to do this or to set up a combo box that will allow me to hide/unhide specific columns....
View Replies!
View Related
Hiding Columns With Zero Value In Table
I was wondering if there was a simple function that will hide all the columns which have Zero value thoughout a pricing spreadsheet. The different elements of the pricing have lead to 60+ columns, upto 75% may not contain a value or may display "false", it is making it very difficult to view and print. At present I am manually auto filterig to see if values are present in the column and then hiding the columns if they are blank (a real pain in the backside).
View Replies!
View Related
|