在以下计算机上运行n_bits = 2
pows = (2 ** np.arange(n_bits))[::-1]
(np.reshape(a, (-1, n_bits)) @ pows).reshape(-1, a.shape[1]//2)
array([[2, 1, 1, 1],
[1, 2, 2, 3],
[2, 2, 3, 0],
[2, 3, 1, 2],
[3, 0, 1, 1]])
时,我得到了一个需要的编译对象。
数据是从表单生成的,并且代码在表单内。
我在出现错误的地方以蓝色突出显示。
.Find
Dim MODATT As String
Dim SearchRange As Range
Dim searchcell As String
Dim NewModShort As String
Dim MakeVal As String
Dim ModVal As String
Dim mdAtt As String
Private Sub ADDPROD_Click()
Worksheets("SKU List").Activate
SKUNUMBER = Range("A1").End(xlDown).Value + 1
Range("A1").End(xlDown).Offset(1).Value = SKUNUMBER
MODATT = Make.Value & " " & Model.Value & " " & PS.Value & "PS"
With Worksheets("Model Att").Range("A1", Range("A1").End(xlDown))
Set mdAtt = .Find(What:=MODATT, LookIn:=xlValues)
If mdAtt Is Nothing Then
Range("A1").End(xlDown).Offset(1).Value = MODATT
MODATT.PutInClipboard
MsgBox "Please add " & MODATT & "to the Model Attributes (This has been copied, ready to paste)", , "Add Attribute"
ModShort
Else
ModShort
End If
End Sub
收到错误:
编译错误:需要对象
答案 0 :(得分:0)
一些注意事项:
mdAtt
声明为String
。声明为Range
。然后使用set
statement就像Range
是一个对象一样。SKUNUMBER
(至少在您提供的代码中)。使用Option Explicit可以防止这种情况。With
块缺少End With
,这会给您带来编译错误。ModShort
的呼叫既在If
的结尾,也在您的Else
语句中。为什么不删除Else
并在您的If
语句完成后运行它呢?If mdAtt Is Nothing Then
' ...
End If
ModShort