下面的代碼是在我的函數的開始使用時,我接收到「用戶類型沒有定義」錯誤。我只是定義一個包含數字的單元格作爲變量,以減少稍後在我的代碼中輸入的數量。我很困惑,我的變量類型是沒什麼特別的,只是一個老好人數..定義變量
Sub PECcalc()
Dim pu238 As [Worksheets("PEC Conversion").Cells(4, 6).Value]
Dim pu241 As [Worksheets("PEC Conversion").Cells(5, 6).Value]
Dim am241 As [Worksheets("PEC Conversion").Cells(6, 6).Value]
Dim pu238PEC As [Worksheets("PEC Conversion").Cells(2, 2).Value]
Dim pu239PEC As [Worksheets("PEC Conversion").Cells(3, 2).Value]
Dim pu240PEC As [Worksheets("PEC Conversion").Cells(4, 2).Value]
Dim pu241PEC As [Worksheets("PEC Conversion").Cells(5, 2).Value]
Dim am241PEC As [Worksheets("PEC Conversion").Cells(6, 2).Value]
Dim np237PEC As [Worksheets("PEC Conversion").Cells(7, 2).Value]
Dim u328PEC As [Worksheets("PEC Conversion").Cells(8, 2).Value]
Dim u235PEC As [Worksheets("PEC Conversion").Cells(9, 2).Value]
'昏暗pu238作爲123.231'(假設電池包含123.231)沒有任何意義 - 嘗試'Dim pu238 As Double:pu238 = Worksheets(「PEC Conversion」)。Cells(4,6).Value' – YowE3K
修復了前3行但是後續行 'Dim pu238PEC As Double :pu238PEC [工作表( 「PEC轉換」)細胞(2,2)。價值]' 給我的錯誤「請編譯錯誤:預期子,功能或屬性」 – Harry
'昏暗pu238PEC作爲雙:[工作表(「PEC轉換」)細胞(2,2)。價值] pu238PEC'應該已經寫在以類似的方式前三 - 即'昏暗pu238PEC爲雙:pu238PEC =工作表(「PEC轉換」)細胞(2,2).Value' – YowE3K