K
Khanh01
Guest
Hello, I have 2 pieces of code I think are equivalent but I don't know why the second code doesn't work at the last statement even though the value is the same. can you explain for me?
first code:
pr_regex = New Regex(strRegexPattern)
Dim match As MatchCollection = pr_regex.matches(text)
Dim a As Integer = match.Count
If a = 0 Then Exit Sub
Dim value(a - 1) As Object, i As Integer
For Each item As Match In match
value(i) = item.Value
i += 1
Next
range.Resize(a, 1).Value2 =Excelapplication.WorksheetFunction.Transpose(value)
'-------------------------------------------------------
second code:
pr_regex = New Regex(strRegexPattern)
Dim match As MatchCollection = pr_regex.matches(text)
Dim a As Integer = match.Count
If a = 0 Then Exit Sub
Dim value(a-1) As Object:match.CopyTo(value,0):
range.Resize(a, 1).Value2 = Excelapplication.WorksheetFunction.Transpose(value)
here is the error i get at last line:
It looks like excelapplication is no longer working. I do not see the its value
Thanks so much!
Continue reading...
first code:
pr_regex = New Regex(strRegexPattern)
Dim match As MatchCollection = pr_regex.matches(text)
Dim a As Integer = match.Count
If a = 0 Then Exit Sub
Dim value(a - 1) As Object, i As Integer
For Each item As Match In match
value(i) = item.Value
i += 1
Next
range.Resize(a, 1).Value2 =Excelapplication.WorksheetFunction.Transpose(value)
'-------------------------------------------------------
second code:
pr_regex = New Regex(strRegexPattern)
Dim match As MatchCollection = pr_regex.matches(text)
Dim a As Integer = match.Count
If a = 0 Then Exit Sub
Dim value(a-1) As Object:match.CopyTo(value,0):
range.Resize(a, 1).Value2 = Excelapplication.WorksheetFunction.Transpose(value)
here is the error i get at last line:
It looks like excelapplication is no longer working. I do not see the its value
Thanks so much!
Continue reading...