我在前面道歉......
我是一名狂热的Excel用户,但不熟悉VBA。任何帮助表示赞赏。
这是我到目前为止尝试的代码:
dim input as string
input = inputbox("Insert date in format ddmmyyyy")
Workbooks.open (""\\vmp-avayaacc\reports\servicedesk\Josh\Agent By Skillset Performance" & input & "1155.csv"")
Workbooks("(""\\vmp-avayaacc\reports\servicedesk\Josh\Agent By Skillset Performance" & input & "1155.csv"")).Worksheets("Sheet1").Range("AN1:AS1").Copy _
Workbooks("http://sharepoint.coh.org/SiteDirectory/ITS/BO/Dashboard.xls").Worksheets("Sheet1").Range("A1")
有人可以帮我做这项工作吗?谢谢。
答案 0 :(得分:0)
您可以将最后一行更改为Range("A2")
:
Workbooks(""\\vmp-avayaacc\reports\servicedesk\Josh\Agent By Skillset Performance" & input & "1155.csv"").Worksheets("Sheet1").Range("AN1:AS1").Copy _
Workbooks("http://sharepoint.coh.org/SiteDirectory/ITS/BO/Dashboard.xls").Worksheets("Sheet1").Range("A2")
然后将它前面的日期添加到单元格A1:
Workbooks("http://sharepoint.coh.org/SiteDirectory/ITS/BO/Dashboard.xls").Worksheets("Sheet1").Range("A1").Value=input
希望这有帮助。
答案 1 :(得分:0)
将此代码复制到启用宏的工作表的VBA窗口中,并执行F5或将其作为宏指定给按钮或其他控件对象:
Public Sub CopyCells()
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Dim wkb2 As Excel.Workbook
Dim wks2 As Excel.Worksheet
Dim strMSG As String
strMSG = InputBox("Insert date in format ddmmyyyy")
Set wkb = Excel.Workbooks.Open("\\vmp-avayaacc\reports\servicedesk\Josh\Agent By Skillset Performance" & strMSG & "1155.csv")
Set wkb2 = Excel.Workbooks.Open("http://sharepoint.coh.org/SiteDirectory/ITS/BO/Dashboard.xls")
Set wks = wkb.Worksheets("Sheet1"): wks.Activate
wks.Range("AN1:AS1").Copy
Set wks2 = wkb2.Worksheets("Sheet1")
wks2.Range("A1").PasteSpecial xlPasteAll
Set wks = Nothing: Set wkb = Nothing
set wks2 = nothing: set wkb2 = nothing
End Sub