Came into another snag formating my Pivot Chart via VBA in Access 2010. I get the "Run-time error '438': Object doesn't support this property or method" error.
Again, I have tried many different iterations of the code, but can't get the right one. As always, thank you in advance for your assistance.
Private Sub Form_Load()
'Call LineMarkerFormat
RONMax = DMax("[Total A/C]", "tblRONChartComparison")
RONMin = DMin("[Total A/C]", "tblRONChartComparison")
With Me.ChartSpace.Charts(0).Axes(1).Scaling
.MinimumScale = RONMin
.MaximumScale = RONMax
End With
End Sub
and the very next site I check had the very simple solution. you no longer need the scaling on the end of the .minimum/.maximum. Here is my working code.
Private Sub Form_Load()
'Call LineMarkerFormat
RONMax = DMax("[Total A/C]", "tblRONChartComparison")
RONMin = DMin("[Total A/C]", "tblRONChartComparison")
With Me.ChartSpace.Charts(0).Axes(1).Scaling
.Minimum = RONMin
.Maximum = RONMax
End With
End Sub
Related
i have 5 pages in multipage userform.
if the next button enabled, which it can be clicked by user then it should move to next hidden page, i always got an error "Object Required" it drives me crazy.
Private Sub btnGenerate_Click()
iPageNo = MultiPage1.Value + 1
MultiPage1.Pages(iPageNo).Visible = True
MultiPage1.Value = iPageNo
End Sub
that code seems doesnt work for me, any help would be appreciate.
Thanks
Which line is causing the error when you step thru?
Ensure there are enough existing pages. Also, has the name of the MultiPage object changed?
This code below tested working (2 Pages in MultiPage1, Page2 set hidden):
Option Explicit
Private Sub CommandButton1_Click()
Dim iNextPage As Long
With Me.MultiPage1
iNextPage = .Value + 1
If iNextPage < .Pages.Count Then
.Pages(iNextPage).Visible = True
.Value = iNextPage
End If
End With
End Sub
I have several "Buttons" that change dynamically with the content of the sheet. I just need to figure out 1 line of code to get it working properly (Line 3):
Public Sub ClearMacro(shapename As String)
On Error Resume Next
ActiveSheet.Shapes(shapename).OnAction = Nothing
End Sub
I want to completely remove the macro from the shape, but keep the shape. Anything I can do differently to make this work?
Use Set and Nothing on objects. OnAction accepts a string value, use .OnAction = "" instead.
Public Sub ClearMacro(shapename As String)
On Error Resume Next
ActiveSheet.Shapes(shapename).OnAction = ""
End Sub
I've read lots of other posts (particularly this) and even tried to replicate a few and I don't understand what's wrong.
I'm trying to get a function to run after the spreadsheet has been refreshed. It seems that I have to mess around with query tables, though if there is some way that I can avoid that, please tell me. I've attached what I think are the relevant code snippets (though I could have missed some).
The error I get is runtime eror: '9' Subscript out of range
code in "this workbook"
Dim qtevent As qtClass
Private Sub Workbook_Open()
Set qtevent = New qtClass
Set qtevent.HookedTable = ThisWorkbook.Worksheets("REFRESH SHEET").ListObjects(1).QueryTable
MsgBox "Qt Events Run"
End Sub
Code in class qtClass
Option Explicit
Private WithEvents qt As Excel.QueryTable
Public Property Set HookedTable(q As Excel.QueryTable)
Set qt = q
End Property
Private Sub qt_AfterRefresh(ByVal Success As Boolean)
MsgBox "qt_AfterRefresh called sucessfully."
If Success = True Then
MsgBox "If called succesfully."
End If
End Sub
I'm currently trying to implement some code into my excel so when a user selects one check box the other check boxes will be unselected. This is the following code I have for it:
Sub CheckBox77_Click()
If CheckBox77.Value = True Then
CheckBox78.Value = False
End If
End Sub
Sub CheckBox78_Click()
If CheckBox78.Value = True Then
CheckBox77.Value = False
End If
End Sub
When I test this, I get an error that says:
Run-time error '424': Object Required.
How can I fix this? Thanks!
Ok, you want to place those methods in "Module1", you should use as follow:
If Sheets("sheetname").CheckBox78.Value = True Then
Sheets("sheetname").CheckBox77.Value = False
End If
I'm trying to make a macro that changes the filters of several PivotTables (not all), but i'm getting an error on the PivotFields, here's a sample of my code:
Sheets("Sheet1").PivotTables("PivotTable" & pivot_counter).PivotFields( _
"[year].[year].[year]").VisibleItemList = Array("")
My questions are:
1- Why do we use PivotFields("[year].[year].[year]") when using VisibleItemList? Why do we have to repeat it and what's the meaning of it, couldn't anything about it anywhere.
2- What is supposedly wrong with this code? My pivot table has a field called "year" and the filter is set for a specific year (let's say 2013) and i wanted it change for all possible years.
Sub Tester()
ShowAll ActiveSheet.PivotTables("PivotTable1").PivotFields("Year")
End Sub
Sub ShowAll(pf As PivotField)
Dim pi As PivotItem
Application.ScreenUpdating = False
For Each pi In pf.PivotItems
pi.Visible = True
Next pi
Application.ScreenUpdating = True
End Sub