PDA

View Full Version : Pls help *Urgent* VBA Macro Problem



Levi501
07-06-2016, 08:00 AM
Hi Everyone,

I'm new here and hope someone can help.

I'm building an interactive dashboard in excel, but got stuck editing macro code in order to link chart to control buttons.

getting a dialogue box with error msg:

Run-time error '91'
Object variable or with block variable not set


when I click debug, I opens VBA

Sub Daily()
'
' Daily Macro
'
'
With ActiveChart.PivotLayout.PivotTable.CubeFields("[LeviFF1].[Day]")
.Orientation = xlRowField
.Position = 4
End With
End Sub



I know I have to declare variable but don't know how pls help

thanks

SamT
07-06-2016, 08:11 AM
Bad: ("[LeviFF1].[Day]"). . . Unless those square brackets are part of the actual name, then the solution is different

Good: ("LeviFF1.Day"). . . If that dot is part of the actual name

If LeviFF1 is an Object and Day is a Property of it, then the above doesn't fit.