我有一个超过1000行的表。在列AI F列有像如何检查一个值是否包含特定文本
:IO.Tgr37.Tank37.TT
在片“innstiilinger”一文中,我有一堆关键字来查找, 像Tgr37上ROW7和Tgr10上ROW8
在列GI已经
Tgr 120, Tgr 600.......
如果文本中有Tgr37或Tgr10,我想在文本中添加前缀。 如果文本有Tgr120或Tgr600它我会添加其他前缀文字..
我试过这段代码:
Dim sCellVal As String
sCellVal = Range("A" & ActiveCell.Row).Value
Dim FindString As String
Dim Rng As Range
FindString = sCellVal
If Trim(FindString) <> "" Then
With Sheets("Innstillinger").Range("F:F") 'searches all of column F
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
tag_opc.Value = Sheets("Innstillinger").Range("F6") & Range("A" & ActiveCell.Row).Value & ".Value" 'value found
Else
MsgBox "Nothing found" 'value not found
End If
End With
End If
,但它不工作,当我把我的关键字在A列和F栏中的文字“innstillinger”它的工作原理。
对不起,我的英语不好,但我希望你明白我的问题...... 的Excel 2013
我所指的文字是来自PLC程序的opc标签。我将把标签导入历史记录软件,但标签不完整。我需要为标签添加一些额外的文本,我需要添加的文本取决于它属于的“Tgrxx”。所以我想列出需要“color1”添加到coloum F中的opc-tag(这是大约10个不同的Tgr)的不同Tgr,并且需要添加“text2”的Tgr列在Coloum G ....等等中。 。 –