pivot table

G

geebee

hi,

i have the following code:

e = sheets("sheet1").range("g3").value
msgbox e
with sheets("sheet1").pivottables("pivottable3").pivotfields("FAC")
..pivotitems(e).visible = true
end with

but i am getting a runtime error 1004: unable to get the pivotitems property
ofthe pivotfield class.

i made sure that the value to be made visible is true. and even recorded a
macro with me checking the item to make it visible, to compare my code to
that. but i dont understand why this is not working.

in this case, the item to be made wisible is WBO

thanks in advance,
geebee
 
J

JRForm

geebee,

No you should not. I tested your code and could only get the error when I
put quotes around data in cell g3. How is the value being populated in
g3-typing-pasting from somewhere else?
 
G

geebee

yes... the data is being pasted from somewhere else. it is a result of:
selection.pastespecial paste:=excelvalues, operation:=xlnone,
skipblanks:=true, transpose:=false

i am not sure what to do now...

geebee
 
J

JRForm

geebee,

Did you try typing the value and then running your code? Are you copying a
large amount of data or just the value for g3? If it is just the one value
then create a variable to hold the value and then

<to copy> MyValue = Trim(ActiveCell)

<Paste> Activecell=MyValue
 
G

geebee

hi,

its something wrong somewhere. i even changed the code to the following:
with activesheet.pivottables("pivottable3").pivotfields("fac")
..pivotitems("SSS").visible = true

but i am still getting the same error message.

i am running out of idea on this one.
 
G

geebee

hi,

dos it even matter..especially if i cant even get the following to work:

sheets("sheet1").select
with activesheet.pivottables("pivottable3").pivotfields("fac")
..pivotitems("SSS").visible = true
end with
 
J

JRForm

geebee,

I think so. I can get the code below to work without any issues. But I am
typing in the data, changing the name of the pivottalble to pivottable3 and
it works.
However, it is up to you..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top