|
下面这段代码就是希望TextBox1.Value等于E列的值,但一用E列就报错,用E4什么的单一值,就能通过,已经用红色标注
Private Sub CommandButton1_Click()
If TextBox1.Value = Sheets("人员信息").Range("E:E") Then
Dim mrow1 As Long
mrow1 = Sheets("人员信息").Range("E:E").Find(TextBox1.Value).Row
Sheets("zhenmian").Activate
Sheets("zhenmian").Cells(4, 5).Value = Sheets("人员信息").Range("D" & mrow1)
Sheets("zhenmian").Range("I4").Value = Sheets("人员信息").Range("F" & mrow1)
Sheets("zhenmian").Range("M4").Value = Sheets("人员信息").Range("G" & mrow1)
Sheets("zhenmian").Range("F9").Value = Sheets("人员信息").Range("B" & mrow1)
Sheets("zhenmian").Range("M9").Value = Sheets("人员信息").Range("P" & mrow1)
Sheets("zhenmian").Range("E7").Value = Sheets("人员信息").Range("E" & mrow1)
Sheets("zhenmian").Range("I5").Value = Sheets("人员信息").Range("I" & mrow1)
Sheets("zhenmian").Range("M5").Value = Sheets("人员信息").Range("H" & mrow1)
Sheets("zhenmian").Range("M6").Value = Sheets("人员信息").Range("J" & mrow1)
Sheets("zhenmian").照片.Picture = LoadPicture(ThisWorkbook.Path & "/照片/" & TextBox1.Value & ".jpg")
Else
MsgBox "未选择姓名"
End If
End Sub
|
|