PDA

Click to See Complete Forum and Search --> : Problem with Pivot Table


Fonty
May 30th, 2006, 05:01 PM
I have the following code, where count is a string defined in order to get some data from a pivot table field:

If other = 0 Then
' first I fill some cells with content 1
Range("B" & 58 + s).Value = Worksheets("Constants").PivotTables("tablereg").GetData(count)
ElseIf other= 1 Then
' first I fill some cells with content 2
Range("B" & 58 + s).Value = Worksheets("Constants").PivotTables("tablereg").GetData(count)
End If

The problem is that for other = 0 the code works perfect, it gets the values from the pivot table. However, for other = 1 it crashes and pops up a error mesage saying that there's a missing bracket. Why does this happen? The code is exactly the same as for other = 0. Simply a copy/paste.

Fonty
May 30th, 2006, 05:05 PM
Could it be that a same instruction for a pivot table cannot be repeated inside an IF?

Fonty
May 30th, 2006, 05:11 PM
If fact, once the error appears for other = 1, I can see that the value taken by count is exactly the one that results correct for other = 0.