nuid="!,@,a-z"
但我不希望双引号。 !我想nuid =,@,AZ
推荐我的方法来去除开始和结束的报价
这里是我的代码:
sub highlight(nuid as string)
dim sh3 as worksheet
Set sh3 = Thisworkbook.Worksheets("Sheet1")
sh3.Select
Cells.Find("User ID").Select
ActiveCell.Offset(1, 0).Select
nuid = Replace(nuid, """", "")
Set rn = sh3.UsedRange
k = rn.Rows.Count + rn.Row - 1
For x = 1 To k
If ActiveCell.Value Like nuid Then
Selection.Interior.Color = vbYellow
Else
Selection.Interior.ColorIndex = xlNone
End If
ActiveCell.Offset(1, 0).Select 'moves activecell down one row.
Next
end sub
从我的鬼,我会输入特殊字符,这将将存储在变量nuid.I只想要特殊字符,而不是引号周围
搜索[VBA和替换](https://www.google.se/#q=VBA+replace)。 –