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)。 –