如何在这两行中设置用户范围输入框?

时间:2019-03-25 14:06:34

标签: excel vba

我有一些代码,可以将3种或3种以上的工作技能与庞大的数据集相匹配,并在公司其他可转让这些技能的领域中丢掉工作。代码的工作原理非常好,但是我想为两行代码合并用户输入框。

  1. Set rSkills = Range("A2:A7")我希望用户在A列中选择从第2行到最后输入的工作技能的范围。

  2. If i >= 3 Then我还希望显示一个输入框,并让用户键入他们想要与每个职位匹配的职位技能。如果他们只需要1,我希望输入框允许输入1,或者在需要时输入更多。

如何实现?这是我所有的代码:

Sub FindSkills()

Dim c As Range
Dim r As Range
Dim row As Integer
Dim i As Integer
Dim rSkills As Range
Dim cSkills As Range
Dim JobCodeMatch As Integer
Dim JobTitleMatch As Integer
Dim CLevelMatch As Integer
Dim JobCode As String
Dim JobTitle As String
Dim CareerLevel As String

    row = 2
    JobCodeMatch = 2
    JobTitleMatch = 2
    CLevelMatch = 2

    'Application.ScreenUpdating = False

    Set rSkills = Range("A2:A7")
    Do While row < 2400 
      i = 0 'reset
      JobCode = Cells(row, 6).Value
      JobTitle = Cells(row, 7).Value
      CareerLevel = Cells(row, 14).Value

      Set r = Range(Cells(row, 6), Cells(row, 336))
      For Each c In r
        For Each cSkills In rSkills
          If c.Value = cSkills.Value Then i = i + 1
        Next cSkills
      Next c
      If i >= 2 Then
        Cells(JobCodeMatch, 3) = JobCode 'Column C
        Cells(JobTitleMatch, 4) = JobTitle 'Column D
        Cells(CLevelMatch, 5) = CareerLevel
        JobCodeMatch = JobCodeMatch + 1
        JobTitleMatch = JobTitleMatch + 1
        CLevelMatch = CLevelMatch + 1
      End If
      row = row + 1
    Loop

    'Application.ScreenUpdating = True

End Sub

0 个答案:

没有答案