一个宏操作方法是否可以改进
代码若下:主要目的就是设置单元格的超链接,目前此法效率太低,不知道是否有改进的可能?
--------------------------------------
Dim objCurSheet As Object
Set objCurSheet = Sheets(1)
objCurSheet.Activate
Dim i As Integer
Dim intStartRowOfTarget As Integer
For i = 0 To intProdCount - 1
intStartRowOfTarget = 6 + i * intRowCountOfPerProd
Dim strPatternCD As String
Dim strUrlOfPattern As String
strPatternCD = Trim(objCurSheet.Cells(intStartRowOfTarget, idxTargetCol))
strUrlOfPattern = strPicturesDirOfPattern & strPatternCD & ".jpg"
If strPatternCD <> "" Then
Cells(intStartRowOfTarget, idxTargetCol).Select
ActiveSheet.hyperlinks.Add Anchor:=Selection, Address:=strUrlOfPattern, TextToDisplay:=strPatternCD
End If
Next
--------------------------------------
[解决办法]
这个发到excelhome吧,那里有很多研究vba优化的。