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 Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
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 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 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 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
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
Set Print Orientation On All Worksheets
how would I change the orientation on ALL my worksheets, I'm saying every single one, imagine I got like 100 for the purpose of this excercise (sorry I'm not trying to make this harder, it's just there's always that one guy that'll come on and say 'Go to Print Print Preview, then click on Setup' or something like that. So yeah, that's pretty much the question that I have for you brainaics: How do I change the printer orientation setting to landscape on all worksheets (maybe a loop?).
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
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 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 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 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
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
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
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
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
Check For PivotField Existence
i am using VBA to handle a pivottable in excel. i am using pt.PivotFields("Position Status").Orientation = xlHidden to hide a field. but what if this field is not there in the first place? how should i put a "if" clause so that if this field is not there, i can skip this and go to next action?
View Replies!
View Related
Manipulate Pivotfield Without Names
Range("B5").Select With ActiveSheet. PivotTables("mypivot).PivotFields("team") .Orientation = xlRowField .Position = 2 This will move the data row field called "team" to be the second from the left. I would like a way to move whatever (without mentioning the field's name) field is in position 2 to position 3. Similar to an "offset" to the right.
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
Listbox Does Change Orientation
I have a listbox that gets filled via '.rsRS.GetRows', which works great; all rows are being displayed neatly. However, when the recordset only holds one record, i.e. one row is desired to appear in the listbox, then the listbox changes its orientation: instead of one row with seven columns I get one column with seven rows! The listbox properties in the local window states that the lbx.List() object has a column count of '7', but what I see looks like: [] name [] surname [] age [] zip [] colour [] dob [] phone It should look like: [] name surname age zip color dob phone
View Replies!
View Related
Changing A Graph To Vertical Orientation
I have a normal line graph I would like to see plotted vertically rather than the normal horizontal layout. In other words, points/lines would appear around a vertical axis and go from side to side. The normal graph would look as if it was tipped on its left side.
View Replies!
View Related
Formula To Manage Output Orientation
Assuming I’ve the following sample data and wishing if the output data could be formatted using some excel formulas, refer to below sample. Sample data (Sheet1): StudentA | Lesson1 StudentA | Lesson21 StudentA | Lesson10 StudentA | Lesson5 StudentB | Lesson5 StudentB | Lesson6 StudentC | Lesson9 StudentC | Lesson8 StudentC | Lesson9 StudentC | Lesson15 StudentC | Lesson11 StudentC | Lesson30 StudentC | Lesson13 StudentD | Lesson1 StudentD | Lesson2 StudentD | Lesson3 StudentD | Lesson4 StudentD | Lesson5 StudentD | Lesson6 StudentD | Lesson7 StudentD | Lesson8 Sample output (Sheet2): StudentA | StudentB | StudentC | StudentD Lesson1 | Lesson5 | Lesson9 | Lesson1 Lesson21 | Lesson6 | Lesson8 | Lesson2 Lesson10..................Lesson9 | Lesson3 Lesson5....................Lesson15 | Lesson4 .................................Lesson11 | Lesson5 .................................Lesson30 | Lesson6 .................................Lesson13 | Lesson7 ..................................................Lesson8 The sample data could be long and a lot, so it's best if the formula can be made flexible to cater for this requirement. Please refer to the attached file for some sample data.
View Replies!
View Related
Custom Toolbar Orientation. Horizontal & Vertical
How do you control the orientation of a floating toolbar? The code below puts the elements horizontally, while I'd like to make the toobar have a vertical format (one macro per line). I'd also be interested if there's a way to do sub-menus to organize the toolbar buttons better. how to revise the code below, and/or a pointer to where I can read about this. I tried searching google and this forum to no avail. Option Explicit Public Const ToolBarName As String = "My Toolbar" Sub Auto_Open() Call CreateMenubar End Sub Sub Auto_Close() Call RemoveMenubar End Sub Sub RemoveMenubar() On Error Resume Next Application.CommandBars(ToolBarName).Delete On Error Goto 0 End Sub Sub CreateMenubar()......................
View Replies!
View Related
Cell Ranges And Have Lines And Shapes Come Along For The Ride, And Disembark With The Same Orientation
I'd like to just copy or move cells or cell ranges and have lines and shapes come along for the ride, and disembark with the same orientation. E.g. if cell E29 has an arrow through his head, I'd like AA66 to after copying there. I haven't got the knack of when I've selected enough to grab the shape. Sometimes I think I've got it but when I paste I discover that the slippery critter stayed at home. But sometimes I just cut one cell and the shapes move too. Any advice? BTW, I stay on the keyboard, and off the mouse, as much as possible - I'd like to avoid slowing down to make mouse selections.
View Replies!
View Related
Unable To Use Filters
I have a worksheet that is unprotected but I am unable to apply filters to it. The option is greyed out if I try and select autofilters. Another strange thing is that on one of the worksheets when I select Data, Filters there is a tick to the left of Autofilter but it is also greyed out, so in effect I cannot turn it off even tho I can't see the filters! I have tried to popst a screen shot but unsure how to do it. I think maybe a screen shot would help to explain my issue better so if anyone knows how to do this......
View Replies!
View Related
Unable To Sort Correctly
I have a column with a value resulting from a fairly complex formula: I will not include the formula, but basically what it does is a number of calculations including subtracting dates, that is TODAY'S DATE - A GIVEN DATE (provided in a different cell) That means that, either manually or automatically, those values are constantly recalculating (with every second that goes by, that value changes). And the number of values/cells to update is not few: about 1100. Here's the problem. When I press SORT, Excel seems to be absolutely incapable of sorting that list correctly. The values are completely and randomly out of order. I wonder if it could be due to the fact that given that those values would be constantly changing, there would be a conflict with the commands sort update
View Replies!
View Related
Unable To Figure Out Sumproduct
I've been unable to figure this out for the past few hours so I figure I better turn to. I need to sum all "orders.price" on sheet 1 when, 1. SaleDate is within the two reference dates(basically monthly) 2. location field in sheet 1 contains the particular string of text Using the filter function, I've narrowed down that the results of these are not correct at all. The actual sales are consistent through the months, so each month should have a number in it, yet the worksheet results in almost all of the fields equaling zero.
View Replies!
View Related
Unable To Retrieve My Files
I recently formatted my laptop harddrive. I'm running windows XP Pro. I backed up all files to my 500GB WD external drive. All is fine except that I'm now unable to retrieve my excel files and no one has been able to really help. These spreadsheets are very important to me.
View Replies!
View Related
Unable To Link In Certain Cells
I have inherited a workbook and wish to link certain cells from various worksheets.On one work sheet I am unable to selct any cell (cursor does not change) to link in and on another sheet there are a just a range of cells I cannot access - everywhere else works normally. There are no macros and the workbook is not protected.
View Replies!
View Related
|