Excel 2013 Comment is not working in Excel 2013

jawahars
2StarLounger
Posts: 113
Joined: 09 Jan 2014, 10:06
Location: Chennai, Tamil nadu, india.

Excel 2013 Comment is not working in Excel 2013

Post by jawahars »

Hi I can able to use the below coding in excel 2013

and i am geting error code Run time error 13 Type Mismatch. Please help


Coding i use now to work in 2003 macro:-

Code: Select all

Function WorksheetExists(WorksheetName As String) As Boolean

Dim sht As Object

For Each sht In ActiveWorkbook.Sheets

    If sht.Name = WorksheetName Then WorksheetExists = True: Exit For

Next sht

End Function
Sub BD_Adj_JV_1()

Application.DisplayAlerts = False

If WorksheetExists("Working") = True Then Sheets("Working").Delete
If WorksheetExists("159901") = True Then Sheets("159901").Delete
If WorksheetExists("JE") = True Then Sheets("JE").Delete

Sheets("base").Select
rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Dim myrange1 As Range
Set myrange1 = Sheets("base").Range("A1:H" & rn1)

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
        myrange1).CreatePivotTable _
        TableDestination:="", TableName:="PivotTable1", DefaultVersion _
        :=xlPivotTableVersion10
Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
        "PivotTable1").PivotFields("GL Amount"), "Sum of GL Amount", xlSum
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of GL Amount")
        .NumberFormat = "0.00_);(0.00)"
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Batch #")
        .Orientation = xlRowField
        .Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("GL Code")
        .Orientation = xlRowField
        .Position = 2
End With
ActiveSheet.PivotTables("PivotTable1").PivotFields("Batch #").Subtotals = Array _
        (False, False, False, False, False, False, False, False, False, False, False, False)
ActiveWorkbook.ShowPivotTableFieldList = False

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Range("F12").Select

ActiveSheet.Name = "Working"

Columns("B:B").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 2), TrailingMinusNumbers:=True

Range("A1").Select
Selection.EntireRow.Delete

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = 2 To rn1 - 1
    If Cells(r, "A").Value = "" Then Cells(r, "A").Value = Cells(r - 1, "A").Value
Next

Range("C1").Select
Selection.EntireColumn.Insert
Range("C1").Value = "Description"

For r = rn1 - 1 To 2 Step -1
    If Cells(r, "D").Value = 0 Or Cells(r, "D").Value = -0 Then Rows(r).Delete
Next

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = 2 To rn1 - 1
    Cells(r, "C").Value = "OARS Adj> " & Cells(r, "A").Value
Next


Range("A2:D" & rn1 - 1).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal

Sheets("mapping").Select
rn2 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Dim myrange2 As Range
Set myrange2 = Sheets("mapping").Range("A2:F" & rn2)

Sheets("Working").Select
rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Columns("E:E").Select
Selection.NumberFormat = "@"

For r = 2 To rn1 - 1
    vfind = Cells(r, "B").Value
    On Error Resume Next
    Cells(r, "E").Value = Application.WorksheetFunction.VLookup(vfind, myrange2, 5, False)
    Cells(r, "F").Value = Application.WorksheetFunction.VLookup(vfind, myrange2, 6, False)
Next

Range("A" & rn1).Select
Selection.EntireRow.Delete

Range("E1").Value = "New Code"
Range("F1").Value = "Extension"

Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.EntireColumn.AutoFit
Rows("1:1").Select
Selection.Font.Bold = True


End Sub

Sub BD_Adj_JV_2()

Sheets("Working").Select
Sheets("Working").Copy before:=Sheets(1)
Sheets("Working (2)").Select
Sheets("Working (2)").Name = "JE"

Sheets("base").Select
Sheets("base").Copy after:=Sheets(1)
Sheets("base (2)").Select
Sheets("base (2)").Name = "159901"
    
rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row
    
For r = rn1 To 2 Step -1
    If Cells(r, "F").Value = 159901 Then Cells(r, "I").Value = 1
Next

Range("A2:I" & rn1).Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal



start_row = 0
For r = 2 To rn1
    If Cells(r, "I").Value <> 1 Then
       start_row = r
       Exit For
    End If
Next

If start_row > 0 Then
   Range("A" & start_row, "A" & rn1).Select
   Selection.EntireRow.Delete
End If

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = 2 To rn1
    Cells(r, "I").Value = Left(Cells(r, "C").Value & "/" & Cells(r, "B").Value, 30)
    Cells(r, "J").Value = "24560101X901"
    Cells(r, "K").Value = "000000200000C1000010000000"
Next

Columns("G:G").Select
Selection.Copy
Columns("J:J").Select
Selection.Insert Shift:=xlToRight

Sheets("JE").Select
rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = rn1 To 2 Step -1
    If Cells(r, "B").Value = "159901" Then Rows(r).Delete
Next

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Sheets("159901").Select
rn2 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row
Range("I2:L" & rn2).Select
Selection.Copy
Sheets("JE").Select
Range("C" & rn1 + 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Cells.Select
Selection.EntireColumn.AutoFit

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

stot = 0
sdesc = "OARS Adj>"
For r = 2 To rn1
    If Cells(r, "B").Value = "105060" Then
       stot = stot + Cells(r, "D").Value
       If sdesc = "OARS Adj>" Then
          sdesc = sdesc & " " & Cells(r, "A").Value
       Else
          sdesc = sdesc & " & " & Cells(r, "A").Value
       End If
    End If
Next

Sheets("105060").Select
Range("E1").Value = sdesc
Range("E2").Value = stot

Sheets("JE").Select
rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = rn1 To 2 Step -1
    If Cells(r, "B").Value = "105060" Then Rows(r).Delete
Next

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Sheets("105060").Select
Range("B5:E15").Select
Selection.Copy
Sheets("JE").Select
Range("C" & rn1 + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Application.CutCopyMode = False

Columns("D:D").Select
Selection.NumberFormat = "0.00_);(0.00)"

Range("A1:B1").Select
Selection.EntireColumn.Delete

Range("A1:A3").Select
Selection.EntireRow.Insert

Range("A1").Select
Selection.EntireColumn.Insert

Range("B1").Value = "<< Pre-assigned JE number >>"
Range("B2").Value = "<< JE Description >>"
Range("C1").Value = " Session : "
Range("C2").Value = " Amount : "
Range("A2").Value = "OARS Adj> "

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

Range("A4").Value = "Account"
Range("D" & rn1 + 1).Value = "12211001X060"
Range("E" & rn1 + 1).Value = "000000200000C1000010000000"

rn1 = Cells.Find(What:="*", after:=Range("a1"), _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious).Row

For r = 5 To rn1
    Cells(r, "A").Value = Cells(r, "D").Value & Cells(r, "E").Value
Next

Range("A1:D2").Select
Selection.Interior.ColorIndex = 15
Selection.Font.Bold = True

Cells.Select
Selection.EntireColumn.AutoFit


gtot = 0
For r = 5 To rn1 - 1
    gtot = gtot + Cells(r, "C").Value
Next

Range("C" & rn1).Value = -gtot
Cells.Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 9

For r = 5 To rn1
    Cells(r, "C").Value = Application.WorksheetFunction.Round(Cells(r, "C").Value, 2)
Next

Range("A1").Select

End Sub
Last edited by HansV on 01 Apr 2016, 15:23, edited 1 time in total.
Reason: to add [code] and [/code] tags as suggested by StuartR

User avatar
StuartR
Administrator
Posts: 12615
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Excel 2013 Comment is not working in Excel 2013

Post by StuartR »

Can you let us know which line generates the error message?

If you put [code] in front of the code in your post and [/code] at the end then it will retain any indenting, that would make it easier to read.
StuartR


User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Excel 2013 Comment is not working in Excel 2013

Post by Rudi »

Try this version

Code: Select all

Function WorksheetExists(WorksheetName As String) As Boolean
Dim sht As Object
    For Each sht In ActiveWorkbook.Sheets
        If sht.Name = WorksheetName Then WorksheetExists = True: Exit For
    Next sht
End Function

Sub BD_Adj_JV_1()
    Application.ScreenUpdating = True
    Application.DisplayAlerts = False
    If WorksheetExists("Working") = True Then Sheets("Working").Delete
    If WorksheetExists("159901") = True Then Sheets("159901").Delete
    If WorksheetExists("JE") = True Then Sheets("JE").Delete
    Sheets("base").Select
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim myrange1 As Range
    Set myrange1 = Sheets("base").Range("A1:H" & rn1)
    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=myrange1).CreatePivotTable TableDestination:="", TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
    Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables("PivotTable1").PivotFields("GL Amount"), "Sum of GL Amount", xlSum
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of GL Amount")
        .NumberFormat = "0.00_);(0.00)"
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Batch #")
        .Orientation = xlRowField
        .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("GL Code")
        .Orientation = xlRowField
        .Position = 2
    End With
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Batch #").Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveWorkbook.ShowPivotTableFieldList = False
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Range("F12").Select
    ActiveSheet.Name = "Working"
    Columns("B:B").Select
    Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 2), TrailingMinusNumbers:=True
    Range("A1").Select
    Selection.EntireRow.Delete
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = 2 To rn1 - 1
        If Cells(r, "A").Value = "" Then Cells(r, "A").Value = Cells(r - 1, "A").Value
    Next
    Range("C1").Select
    Selection.EntireColumn.Insert
    Range("C1").Value = "Description"
    For r = rn1 - 1 To 2 Step -1
        If Cells(r, "D").Value = 0 Or Cells(r, "D").Value = -0 Then Rows(r).Delete
    Next
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = 2 To rn1 - 1
        Cells(r, "C").Value = "OARS Adj> " & Cells(r, "A").Value
    Next
    Range("A2:D" & rn1 - 1).Select
    Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
    Sheets("mapping").Select
    rn2 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim myrange2 As Range
    Set myrange2 = Sheets("mapping").Range("A2:F" & rn2)
    Sheets("Working").Select
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Columns("E:E").Select
    Selection.NumberFormat = "@"
    For r = 2 To rn1 - 1
        vfind = Cells(r, "B").Value
        On Error Resume Next
        Cells(r, "E").Value = Application.WorksheetFunction.VLookup(vfind, myrange2, 5, False)
        Cells(r, "F").Value = Application.WorksheetFunction.VLookup(vfind, myrange2, 6, False)
    Next
    Range("A" & rn1).Select
    Selection.EntireRow.Delete
    Range("E1").Value = "New Code"
    Range("F1").Value = "Extension"
    Cells.Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Selection.EntireColumn.AutoFit
    Rows("1:1").Select
    Selection.Font.Bold = True
    Application.ScreenUpdating = False
End Sub

Sub BD_Adj_JV_2()
    Application.ScreenUpdating = True
    Sheets("Working").Select
    Sheets("Working").Copy before:=Sheets(1)
    Sheets("Working (2)").Select
    Sheets("Working (2)").Name = "JE"
    Sheets("base").Select
    Sheets("base").Copy after:=Sheets(1)
    Sheets("base (2)").Select
    Sheets("base (2)").Name = "159901"
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = rn1 To 2 Step -1
        If Cells(r, "F").Value = 159901 Then Cells(r, "I").Value = 1
    Next
    Range("A2:I" & rn1).Select
    Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
    start_row = 0
    For r = 2 To rn1
        If Cells(r, "I").Value <> 1 Then
            start_row = r
            Exit For
        End If
    Next
    If start_row > 0 Then
        Range("A" & start_row, "A" & rn1).Select
        Selection.EntireRow.Delete
    End If
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = 2 To rn1
        Cells(r, "I").Value = Left(Cells(r, "C").Value & "/" & Cells(r, "B").Value, 30)
        Cells(r, "J").Value = "24560101X901"
        Cells(r, "K").Value = "000000200000C1000010000000"
    Next
    Columns("G:G").Select
    Selection.Copy
    Columns("J:J").Select
    Selection.Insert Shift:=xlToRight
    Sheets("JE").Select
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = rn1 To 2 Step -1
        If Cells(r, "B").Value = "159901" Then Rows(r).Delete
    Next
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("159901").Select
    rn2 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("I2:L" & rn2).Select
    Selection.Copy
    Sheets("JE").Select
    Range("C" & rn1 + 1).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Cells.Select
    Selection.EntireColumn.AutoFit
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    stot = 0
    sdesc = "OARS Adj>"
    For r = 2 To rn1
        If Cells(r, "B").Value = "105060" Then
            stot = stot + Cells(r, "D").Value
            If sdesc = "OARS Adj>" Then
                sdesc = sdesc & " " & Cells(r, "A").Value
            Else
                sdesc = sdesc & " & " & Cells(r, "A").Value
            End If
        End If
    Next
    Sheets("105060").Select
    Range("E1").Value = sdesc
    Range("E2").Value = stot
    Sheets("JE").Select
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = rn1 To 2 Step -1
        If Cells(r, "B").Value = "105060" Then Rows(r).Delete
    Next
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("105060").Select
    Range("B5:E15").Select
    Selection.Copy
    Sheets("JE").Select
    Range("C" & rn1 + 1).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Columns("D:D").Select
    Selection.NumberFormat = "0.00_);(0.00)"
    Range("A1:B1").Select
    Selection.EntireColumn.Delete
    Range("A1:A3").Select
    Selection.EntireRow.Insert
    Range("A1").Select
    Selection.EntireColumn.Insert
    Range("B1").Value = "<< Pre-assigned JE number >>"
    Range("B2").Value = "<< JE Description >>"
    Range("C1").Value = " Session : "
    Range("C2").Value = " Amount : "
    Range("A2").Value = "OARS Adj> "
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("A4").Value = "Account"
    Range("D" & rn1 + 1).Value = "12211001X060"
    Range("E" & rn1 + 1).Value = "000000200000C1000010000000"
    rn1 = Cells.Find(What:="*", after:=Range("a1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For r = 5 To rn1
        Cells(r, "A").Value = Cells(r, "D").Value & Cells(r, "E").Value
    Next
    Range("A1:D2").Select
    Selection.Interior.ColorIndex = 15
    Selection.Font.Bold = True
    Cells.Select
    Selection.EntireColumn.AutoFit
    gtot = 0
    For r = 5 To rn1 - 2
        gtot = gtot + Cells(r, "C").Value
    Next
    Range("C" & rn1).Value = -gtot
    Cells.Select
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 9
    For r = 5 To rn1 - 2
        Cells(r, "C").Value = Application.WorksheetFunction.Round(Cells(r, "C").Value, 2)
    Next
    Range("A1").Select
    Application.ScreenUpdating = False
End Sub
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

jawahars
2StarLounger
Posts: 113
Joined: 09 Jan 2014, 10:06
Location: Chennai, Tamil nadu, india.

Re: Excel 2013 Comment is not working in Excel 2013

Post by jawahars »

I am geting the same error in the below line

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=myrange1).CreatePivotTable TableDestination:="", TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10

User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 Comment is not working in Excel 2013

Post by HansV »

That part of the code is correct in itself, so perhaps there is something wrong with the data,
Click in the offending line and set a breakpoint by pressing F9.
When you run the code, it will pause there.
Hover the mouse pointer over the variable rn1.
You should see the value of this variable.
Alternatively, type the following in the Immediate window and press Enter:

? rn1

What is the value of rn1?
Best wishes,
Hans

jawahars
2StarLounger
Posts: 113
Joined: 09 Jan 2014, 10:06
Location: Chennai, Tamil nadu, india.

Re: Excel 2013 Comment is not working in Excel 2013

Post by jawahars »

it is 902678

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Excel 2013 Comment is not working in Excel 2013

Post by Rudi »

The value you are getting for variable rn1 should also not cause the error.
I have attempted to recreate the error based on the current macro and I am not getting the error you describe?

I'm not too sure what else to suggest?

BTW:
Since you are now using Excel 2013, you could change this:
DefaultVersion:=xlPivotTableVersion10

to this:
DefaultVersion:=xlPivotTableVersion15 (or even this: DefaultVersion:=xlPivotTableVersionCurrent)
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 Comment is not working in Excel 2013

Post by HansV »

By the way, what happens if you change

ActiveWorkbook.PivotCaches.Add(...

to

ActiveWorkbook.PivotCaches.Create(...
Best wishes,
Hans