我正在尝试编写在VBA中执行以下操作的代码,但是我收到错误:类型不匹配
夸克是一个字符串变量
If quark = "F" Or "DE" Or "ED" Then
Run Code Online (Sandbox Code Playgroud) 我有一个宏(CMOV)调用另一个子程序(CMOV2),它检查一个条件,如果满足,它显示一个vbokaycancel消息框,我设置等于一个名为irep的变量,
我想要它,如果有人点击取消(irep = 2)它取消整个宏.这不仅是退出CMOV2而且退出CMOV.
目前,我有
If jackal(1) <> vbNullString Then
irep = MsgBox("Warning: You have a selection with two swingarms" _
& " that are on the same radius and cannot swing past one another " _
& Chr$(13) & " Choose Okay if you still wish to proceed otherwise " _
& " choose Cancel to revise your order" & Chr$(13) & " " _
& jackal(1) & Chr$(13) & " " & jackal(2), vbOKCancel)
**If irep = 2 …Run Code Online (Sandbox Code Playgroud) 我试图做到这一点,以便我可以找到"灯"的第二个结果,以防这个术语出现各种情况.下面的代码找到了所考虑范围内的第一个匹配项.
Dim ws As Worksheet
Dim rng1 As Range
Dim y As Range
Columns("B:B").Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Select
Set x = Range(Selection, Selection.End(xlDown)).Offset(0, 3)
Range(x.Address(0, 0)).Select
Selection.Find(What:="Lights", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.FindNext(After:=ActiveCell).Activate
Selection.FindNext(After:=ActiveCell).Select
Run Code Online (Sandbox Code Playgroud) 下面的代码是我写的一个宏的片段,用于警告用户他们可能没有足够数量的兼容安装设备.n个缺陷(即,没有兼容安装设备的设备项目的每个实例都保存在元素1到n的yankees()数组中.我想要做的是提示用户输入一个消息框,说明"请检查您的订单以确保你有足够的兼容安装设备 - 我们检测到以下不足之处"
在那之下
在消息框中的单独行中包括yankees(1到n)的所有元素,下面有两个选项"这没关系,我现在将提交订单"和"让我回去,我想修改我的订单".
我该如何创建这样的消息框?
我有:
MsgBox "Please review your order to ensure you have you sufficient compatible installation equipment- we detected the following concerns" & yankee(1), vbOKCancel
Run Code Online (Sandbox Code Playgroud)
目前但这只包括第一次缺口.如何包含yankee()的所有元素并将它们放在自己的行上?
这个问题实际上归结为:"如何在消息框提示符中将数组变量的所有非空元素放在自己的行上"?
Do
If rip(qbert) < k(qbert) Then
yankee(jets) = "Your order for" & s(qbert) & " contains " & k(qbert) - rip(qbert) & " too few " & g(qbert)
jets = jets + 1
qbert = qbert + 1
Else
qbert = qbert + 1
End If
Loop Until qbert …Run Code Online (Sandbox Code Playgroud)