ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Silly Problem with Variable (https://www.excelbanter.com/excel-programming/357687-silly-problem-variable.html)

pikapika13[_5_]

Silly Problem with Variable
 

I'm new to VBA.
I'm passing a value to "Acell":

Acell = ActiveCell


However, the following code does not work:
ActiveSheet.PivotTables("PivotTable10").PivotField s("utcid")
..PivotItems(Acell).Visible = False

But when I manually put in "37" (in quotes), it works. Please help.

BTW, is there a way to follow your code step by step? similar to the
formula auditing tool in Excel?

Thanks in advance to people in this forum. I learn a lot more from
here than any other book/website.


--
pikapika13
------------------------------------------------------------------------
pikapika13's Profile: http://www.excelforum.com/member.php...o&userid=10892
View this thread: http://www.excelforum.com/showthread...hreadid=528606


Bob Phillips[_6_]

Silly Problem with Variable
 
Try using a range variable, and then

Set Acell = ActiveCell

You can step your code using F8. You can add a break at a particular line,
select the line and F9, and then start single stepping from there on.
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"pikapika13" wrote
in message ...

I'm new to VBA.
I'm passing a value to "Acell":

Acell = ActiveCell


However, the following code does not work:
ActiveSheet.PivotTables("PivotTable10").PivotField s("utcid")
PivotItems(Acell).Visible = False

But when I manually put in "37" (in quotes), it works. Please help.

BTW, is there a way to follow your code step by step? similar to the
formula auditing tool in Excel?

Thanks in advance to people in this forum. I learn a lot more from
here than any other book/website.


--
pikapika13
------------------------------------------------------------------------
pikapika13's Profile:

http://www.excelforum.com/member.php...o&userid=10892
View this thread: http://www.excelforum.com/showthread...hreadid=528606




Rick R.[_2_]

Silly Problem with Variable
 
Acell = activecell.value


"pikapika13" wrote:


I'm new to VBA.
I'm passing a value to "Acell":

Acell = ActiveCell


However, the following code does not work:
ActiveSheet.PivotTables("PivotTable10").PivotField s("utcid")
.PivotItems(Acell).Visible = False

But when I manually put in "37" (in quotes), it works. Please help.

BTW, is there a way to follow your code step by step? similar to the
formula auditing tool in Excel?

Thanks in advance to people in this forum. I learn a lot more from
here than any other book/website.


--
pikapika13
------------------------------------------------------------------------
pikapika13's Profile: http://www.excelforum.com/member.php...o&userid=10892
View this thread: http://www.excelforum.com/showthread...hreadid=528606




All times are GMT +1. The time now is 05:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com