Board logo

標題: [發問] 只選兩個工作表的值與格式另存新檔 [打印本頁]

作者: missbb    時間: 2015-8-23 15:33     標題: 只選兩個工作表的值與格式另存新檔

this workbook內有多張工作表, 想取attendance report  (**想只存值與數字格式, 不包括程式**)及ee data 另存一個新WORKBOOK 名為leave reocord
下列出現未能知道COPY屬性的錯誤, 求教?
  1. Sub saveanother_leave()


  2. Dim xPath As String
  3. Dim Arr As Variant

  4. xPath = Application.ActiveWorkbook.Path
  5. Arr = Array("attendance report", "ee data")

  6. Sheets(Arr).Copy = Application.NewWorkbook
  7. ActiveWorkbook.SaveAs xPath & "Leave Record" & ".xls"
  8. ActiveWorkbook.Close

  9. End Sub
複製代碼

作者: lpk187    時間: 2015-8-23 17:08

回復 1# missbb
  1. Sub saveanother_leave()
  2. Dim xPath As String
  3. Dim Arr As Variant
  4. xPath = ThisWorkbook.Path & "\"
  5. Arr = Array("attendance report", "ee data")
  6. Sheets(Arr).Copy
  7. ActiveWorkbook.SaveAs xPath & "Leave Record" & ".xls"
  8. ActiveWorkbook.Close
  9. End Sub
複製代碼

作者: missbb    時間: 2015-8-23 18:36

回復 2# lpk187

因ATTENDANCE DATA是有很多FORMULA, 想同時只COPY 值與數字格式, 是要SAVE 新檔之後做, 還是可以同時做 ?




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)