所以我有这个信息列表,我需要用户提交,以便它可以包含在另一张表中。(见下图)我希望这个代码在选择另一行时变灰。因此,如果用户输入"开始"时间,然后我想要"依赖"灰显,用户无法使用它。如果用户点击"依赖"那么"开始时间"需要变灰。这是我目前的代码。
Sub findData()
Dim finalrow As Integer
Dim i As Integer
Dim workflows As String
With Sheets("Sheet1")
workflows = .Range("C5").Value
servergri = .Range("C9").Value
gridf = .Range("C9").Value
StartTime = .Range("c11").Value
End With
With Sheets("Sheet3")
finalrow = .Range("C" & Rows.Count).End(xlUp).Row
For i = 5 To finalrow
If .Cells(i, 3) = workflows And (.Cells(i, 4) = servergri Or .Cells(i, 5) = gridf) Then
.Rows(i).Insert
'Add new information to the new row.
'The new row number is still = i
.Cells(i, 3) = workflows
.Cells(i, 4) = servergri
.Cells(i, 6) = StartTime
.Cells(i, 3).Resize(2, 4).Interior.ColorIndex = 8
'If you only want to add one row then your should exit the loop
Exit For
End If
Next
End With
Sheets("Sheet1").Range("c9").ClearContents
End Sub