0

このコードを実行すると、jackal(1) または jackal(2) に入れる代わりに一致した場合、Jackal(1)(0) または Jackal(2)(0) に入れられます。値が直接 jackal(1) に配置されるように、このコードを書き直すにはどうすればよいですか? 多分それは私のフィルター関数の構文ですか?

Sub cmov2()
'This macro is designed to sniff out multiple selection incompatibilities; specifically     if you choose a L/R Monitor Arm with L/R Swing Light it will Warn.
'Code Section#1: Find if any of the following are on the order EDS-3090, BDS-2530, or     BDS-2589

Dim valid() As String
ReDim valid(1 To 3)
valid(1) = "EDS-3090"
valid(2) = "BDS-2530"
valid(3) = "BDS-2589"
Sheets("Config").Columns("B:B").Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate
 ActiveCell.Select
 rowq = ActiveCell.row
 Selection.End(xlDown).Select
 rowp = ActiveCell.row
 Range("F" & rowq).Select
 Dim Stern() As String
 ReDim Stern(1 To rowp - rowq)
 zea = 1
 Do
 Stern(zea) = Selection.Value
 Selection.Offset(1, 0).Select
 zea = zea + 1
 Loop Until zea = (rowp - rowq)
 Dim quack As Integer
 quack = 1
  Dim jackal() As Variant
 ReDim jackal(1 To 3)
 Do
 Stop
 zee = Filter(Stern(), valid(quack))
 jackal(quack) = z
 quack = quack + 1
 Loop Until quack = 3
' This code creates the wrong structure for this variable i get jackal(1)(0) and things        'like that. Would prefer to check jackal( 1 to end) for <> nullstring
 If jackal(1)(0) = vbNullString Then
    'change to y=1 do if jackal(y)<>vbnullstring then
    'msgbox "warning"

 Exit Sub
 Else
 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", vbOKCancel
 End If
End Sub
4

2 に答える 2

0

私はあなたのアドバイスを受けました Tim ここに私が得たものがあります:
タイプの不一致エラーでフィルター関数に行き詰まっています。理由がわかりません。

Option Explicit
Sub cmov2()
'This macro is designed to sniff out multiple selection incompatibilities; specifically    if you choose a L/R Monitor Arm with L/R Swing Light it will Warn.
'Code Section#1: Find if any of the following are on the order EDS-3090, BDS-2530, or BDS-2589

Dim valid() As String
ReDim valid(1 To 3)
Dim rowq As Integer
Dim rowp As Integer
Dim counter As Integer
Dim compare As String
 Dim quack As Integer
valid(1) = "EDS-3090"
valid(2) = "BDS-2530"
valid(3) = "BDS-2589"
 Sheets("Config").Columns("B:B").Select 
 Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate
 ActiveCell.Select
 rowq = ActiveCell.row
 Selection.End(xlDown).Select
 rowp = ActiveCell.row
 Range("F" & rowq).Select
 Dim Stern() As String
 ReDim Stern(1 To rowp - rowq)
 counter = 1
 Do
 Stern(counter) = Selection.Value
 Selection.Offset(1, 0).Select
 counter = counter + 1
 Loop Until counter = (rowp - rowq)
 quack = 1
  Dim jackal As String

    Do
 Stop
 compare = Filter(Stern(), valid(quack), True)
 quack = quack + 1
 Loop Until quack = 3
 If jackal = vbNullString Then
 Exit Sub
 Else
 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", vbOKCancel
 End If
End Sub
于 2013-09-10T13:38:26.900 に答える