Problems that in excel2000 arent BUT in excel2002 (XP) are!!

  • Thread starter Thread starter stakar
  • Start date Start date
S

stakar

1st problem

code:
--------------------------------------------------------------------------------

Sub CheckBox()
'Checks the columns for concatenate
Dim c As Range

Set c = ActiveSheet.Shapes(Application.Caller).TopLeftCell
If c.Value = "l" Then c.Value = "" Else c.Value = "l"

'Controls the comment
Set rng = Range("$B$1")
rng.Comment.Text Text:=" "
On Error GoTo Err_msg
rng.Comment.Text Text:=rng.Value

Exit Sub

Err_msg:
MsgBox "Problem"

End Sub

--------------------------------------------------------------------------------

At the followin line
rng.Comment.Text Text:=rng.Value
gives me an error
In excel2000 the previous code is working but in excel2002 (xp) i
doesnt

***********************************************

2nd problem
code:
--------------------------------------------------------------------------------

For lngLoop = 1 To UBound(aryIn)
If CStr(aryIn(lngLoop, 1)) <> vbNullString Then 'if its not blan
cell
aryOutput(colUnique.Item(CStr(aryIn(lngLoop, 2)))
aryIn(lngLoop, 1)) = _
aryOutput(colUnique.Item(CStr(aryIn(lngLoop, 2)))
aryIn(lngLoop, 1)) + 1
End If
Next
 
Hi stakar,

For your 1st problem, you might resolve the matter by changing:

rng.Comment.Text Text:=" "

to:

On Error Resume Next
With rng
..Comment.Delete
..AddComment
..Comment.Text Text:=" "
End With

Alternatively:

On Error Resume Next
rng.Comment.Delete

might do.

In both cases, 'On Error Resume Next' is needed to deal with errors caused
by trying to delete comments in cells with no comments.

Cheers
 
Back
Top