用户在(Sheet1)上输入特定信息,即工作流,服务器,位置,开始时间,依赖关系和执行时间。
我有一个图表,标题中包含这些名称。
我需要查找用户输入的信息。我尝试使用Sub Button2_Click()
'Copy the ticket number'
Worksheets("Sheet1").Range("c3").Copy _
Destination:=Worksheets("Sheet3").Range("b2")
Call CopyTable
Call FINDSAL
End Sub
Sub CopyTable()
'
' CopyTable Macro to sheet 3
'
Sheets("Sheet2").Select
Range("D1:I38").Select
Selection.Copy
Sheets("Sheet3").Select
Range("C4").Select
ActiveSheet.Paste
Columns("C:C").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("H:H").EntireColumn.AutoFit
ActiveWindow.SmallScroll Down:=12
End Sub
Sub FINDSAL()
'looking for the specific word'
Dim E_name As String
E_name = Worksheets("Sheet1").Range("C5").Value
sal = Application.WorksheetFunction.VLookup(E_name, Sheet3.Range("c4:h41"), 1, False)
MsgBox sal
End Sub
,但这只适用于一个条件。还有其他我可以使用的东西吗?
这是我的代码:
gradle build
答案 0 :(得分:0)
Sub FINDSAL()
'looking for the specific word'
Dim E_name As String
E_name = Worksheets("Sheet1").Range("C5").Value
if instr(ename,Sheet3.Range("c4:h41")) > 0 then
msgbox Ename & " was found in the range. All range text is " & Sheet3.Range("c4:h41")
msgbox "Set sal as whatever you're trying to get out of this..."
end if
MsgBox sal
End Sub