0

我需要一些帮助。我需要有关设置 Plan="LogInfo[PLAN]" 以及随后出现的不匹配错误的帮助。还需要帮助编写我在 Excel 中以 VBA 格式编写的公式。

查找将从 LogInfo 到 Design,以在用户选择的单元格中显示从设计表到 LogInfo 的值。

Plan 需要匹配 Plan,Soils Report 需要匹配 Soils Report,em 和 ym 值都需要匹配 display design, bw, bd。

Sub WorkInProgress()

'
' Keyboard Shortcut: Ctrl+s
'
    Dim c As Range
    Dim Plan As Range, Soils As Range, emC As Range, emE As Range, ymC As Range, ymE As Range               'dims for LogInfo Table/Worksheet
    Dim Plan1 As Range, Soils1 As Range, emC1 As Range, emE1 As Range, ymC1 As Range, _
    ymE1 As Range, design As Range, bw As Range, bd As Range                                                'dims for Design Table/Worksheet
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim ws1 As Worksheet
    
    Set wb = ThisWorkbook
    Set ws = wb.Worksheets("LogInfo")                   ' Table in this worksheet is also called "LogInfo"
    Set ws1 = wb.Worksheets("Design")                   ' Table in this worksheet is called "Design"
    
    Set Plan = "LogInfo[PLAN]"                          ' Col Header is called PLAN within the table
    Set Plan1 = "Design[PLAN]"                          ' Col Header is called PLAN within the table
    Set Soils = "LogInfo[SOILS REPORT]"                 ' Col Header is called SOILS REPORT within the table
    Set Soils1 = "Design[SOILS REPORT]"                 ' Col Header is called SOILS REPORT within the table
    Set emC = "LogInfo[em CENTER]"                      ' Col Header is called em CENTER within the table
    Set emC1 = "Design[em CENTER]"                      ' Col Header is called em CENTER within the table
    Set emE = "LogInfo[em EDGE]"                        ' Col Header is called em EDGE within the table
    Set emE1 = "Design[em EDGE]"                        ' Col Header is called em EDGE within the table
    Set ymC = "LogInfo[ym CENTER]"                      ' Col Header is called ym CENTER within the table
    Set ymC1 = "Design[ym CENTER]"                      ' Col Header is called ym CENTER within the table
    Set ymE = "LogInfo[ym EDGE]"                        ' Col Header is called ym EDGE within the table
    Set ymE1 = "Design[ym EDGE]"                        ' Col Header is called ym EDGE within the table
    Set design = "Design[Design]"                       ' Col Header is called Design within the table
    Set bw = "Design[BW]"                               ' Col Header is called BW within the table
    Set bd = "Design[BD]"                               ' Col Header is called BD within the table

    If Selection.Columns.Count > 1 Then
        MsgBox "Only select the cells you want numbered"
        Exit Sub
    End If

    For Each c In Selection
        If Not c.Rows.Hidden Then
            c.Value = Application.WorksheetFunction.XLookup()
            'I need help writing the formula above to match this
            '"=XLOOKUP(1,(Design!C[2]=[@PLAN]) * (Design!C[3]=[@[SOILS REPORT]]),Design!C[-4],""Needs To Be Designed"",0)"
            '
            '
            '
            '
        Else
            c.Clear
        End If
    Next c
End Sub
4

0 回答 0