我有一个宏,我希望它从文件A复制第1页,并将其粘贴(使用粘贴特殊值)到文件B中,并隐藏文件B中粘贴的工作表上的宏按钮?这是我的出发点
Private Sub Update_Click()
Sheets("Dallas").Select
Sheets("Dallas").Copy
End Sub
答案 0 :(得分:0)
如果您只想复制单元格值而不是其他任何内容,则快捷方式如下:
dim rgSource as range
dim rgTarget as range
set rgSource = ActiveSheet.UsedRange ' cells containing values on src sheet
set rgTarget = Workbooks.Add.Worksheets(1).Cells(1,1) ' new range on target sheet
set rgTarget = rgTarget.Resize(rgSource.Rows.Count, rgSource.Columns.Count) ' same sz
rgTarget = rgSource.Value ' copies values into the target range on the other sheet