我正在尝试将数据从“A”列中的单元格通过封闭工作表中的“K”列复制到打开的工作表,从单元格“A4”开始,同时保持源格式。工作簿A是我试图复制的工作簿,而工作簿是我试图粘贴的工作簿。
Sub cmdUpdate_Click()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Workbooks.Open Filename:="path to Workbook A", ReadOnly:=True
Windows("Workbook A").Activate
Range("A3" & ":K" & LastRow).Select
Selection.Copy
Workbooks("Workbook B").Cells(Rows.Count, 4).PasteSpecial Paste:=PasteAllUsingSourceTheme
我收到的错误是“选择Range类的方法失败”。
答案 0 :(得分:1)
你能试试吗?这不使用function getAreaColor(){
switch (feature.properties.Name){
case 'Area One' : return { fillColor: 'blue' };
case 'Area Two' : return { fillColor: 'yellow' };
break;
}
};
function areaStyle(){
return {
fillColor: getAreaColor,
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.5
}
};
L.geoJson(myData, {style: areaStyle}).addTo(map);
语句,但仍然复制范围与显式声明的范围相同,而不是使用select
语句(应尽可能避免)
select
进一步评论后更新:
你可以试试这个:
Sub cmdUpdate_Click()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Workbooks.Open Filename:="path to Workbook A", ReadOnly:=True
Workbooks("Workbook A").Range("A3" & ":K" & LastRow).Copy
Workbooks("Workbook B").Cells(Rows.Count, 4).PasteSpecial Paste:=xlPasteAllUsingSourceTheme