首页 > 解决方案 > I'm receiving a "compile error: Can't assign to read-only property" I am not sure what the issue is, can anyone see the problem? seems to be line 6

问题描述

With wsData

LastRow = .Cells(Rows.Count, "A").End(xlUp).Row  
LastColumn = .Cells(1, Columns.Count).End(xlToLeft).Column

Set DataRange = .Range(Cells(1, 1), .Cells(LastRow, LastColumn)) 

Set wsPT = wb.Worksheets.Add 

wsPT.Name = "Pivot Table" 

Set PTCache = wb.PivotCaches.Create(xlDatabase, DataRange)

The Error seems to be showing for the "Name" on line 5

标签: excelvbaautomation

解决方案


推荐阅读