根据列表框选择修改特定单元格

时间:2018-03-16 18:22:40

标签: excel vba excel-vba

需要一些帮助:

我有一个列表框,我想要被选中并使用按钮更改特定单元格中的单元格,我的意思是:

enter image description here

如果我选择micifus并单击一个按钮,它应该转到源单元格并将SI更改为NO

我找到了一个代码,可以获得条目的数量,但尝试使用vlookup函数,还有什么想法?

Private Sub CommandButton4_Click()
    Dim lCol As Long, lRow As Long
    Dim valor_usd As Integer


    With Me.ListBox1
        For lRow = 0 To .ListCount - 1
            If .Selected(lRow) Then 
                For lCol = 0 To .ColumnCount - 1
                    strng = strng & .List(lRow, lCol) & " | "
                Next lCol
                Exit For
            End If
        Next lRow
    End With
    item_select = lbox_por.List(lRow, 0)
    MsgBox item_select
     On Error Resume Next
   valor2 = Application.WorksheetFunction.Match(item_select, Worksheets(4).Range("A2:J19"))
    MsgBox valor2

enter image description here

1 个答案:

答案 0 :(得分:1)

尝试以下一行

type WSGetInfosLink struct {
    XMLName       xml.Name    `xml:"wsGetInfosLink"`
    EncodingStyle SoapenvAttr `xml:"encodingStyle,attr"`
    // ...
}

type SoapenvAttr string

// MarshalXMLAttr implements the xml.MarshalerAttr interface.
func (a SoapenvAttr) MarshalXMLAttr(n xml.Name) (xml.Attr, error) {
    return xml.Attr{
        Name:  xml.Name{Local: "soapenv:" + n.Local},
        Value: string(a),
    }, nil
}