0
我有這個宏(用Excel 2016/Windows編寫),它是一個非常簡單的預定工具,用於檢查資產當前是預訂還是空閒。根據這一點,無論是寫在預訂期將結束或在下次預訂週期將在另一個工作表開始:編譯錯誤:期望的函數或變量
Sub Schaltfläche1_Klicken()
Worksheets("Tabelle10").Activate
With Columns(4)
.Find(what:="*", after:=.Cells(1, 1), LookIn:=xlValues).Activate
End With
ActiveCell.Offset(0, -3).Select
If Selection.Value = "TODAY AM" Then
Sheets("HTML Output").Range("B3").Value = "Desk booked from this afternoon. Next availability"
ActiveCell.Offset(0, 3).Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Select
ActiveCell.Offset(0, -2).Select
Selection.Copy
Sheets("HTML Output").Range("C3").PasteSpecial xlPasteValues
ActiveCell.Offset(0, 1).Select
Selection.Copy
Sheets("HTML Output").Range("D3").PasteSpecial xlPasteValues
ElseIf Selection.Value = "TODAY PM" Then
Sheets("HTML Output").Range("B3").Value = "Desk booked from this afternoon. Next availability"
ActiveCell.Offset(0, 3).Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Select
ActiveCell.Offset(0, -2).Select
Selection.Copy
Sheets("HTML Output").Range("C3").PasteSpecial xlPasteValues
ActiveCell.Offset(0, 1).Select
Selection.Copy
Sheets("HTML Output").Range("D3").PasteSpecial xlPasteValues
ElseIf Selection.Value = "TOMORROW AM" Or Selection.Value = "TOMORROW PM" Or Selection.Value = "FUTURE" Then
Sheets("HTML Output").Range("B3").Value = "Desk free until (including)"
ActiveCell.Offset(-1, 1).Select
Selection.Copy
Sheets("HTML Output").Range("C3").PasteSpecial xlPasteValues
ActiveCell.Offset(0, 1).Select
Selection.Copy
Sheets("HTML Output").Range("D3").PasteSpecial xlPasteValues
End If
End Sub
這工作在Office 2016(視窗10),但導致編譯錯誤完美的罰款:預期功能或變量,當我嘗試在Office 2011 for Mac或Office 2015 for Mac中運行它時。
任何人都可以在正確的方向指向我,或者告訴我如何更改代碼以使其工作?
在此先感謝! Jascha
是,當你錯誤的任何行突出? – sous2817
是的,第一行'SubSchaltfläche1_Klicken()' –
你怎麼踢代碼?它是一個ActiveX按鈕點擊事件? – sous2817