G
Greg
I have a question about the following code,
Dim ans
On Error Resume Next
ans = Application.Match(CLng(Label1.Caption), Range("A:A"), 0)
If Not IsError(ans) Then
Application.Index(Range("B:B"), ans) = Label2.Caption +
ActiveCell.Value
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
What I am trying to achieve is with the Application.Index line
How do I get the two values to add together I have tested the code and it
puts the figures where they should go but what i am trying to make happen is
if the cell already has value in it.
i.e. the cell has 2 in it already and label2 has the value of 5 i want i to
show 7 in the cell.
I believe the following line is the problem
= Label2.Caption + ActiveCell.Value
Thanks
Greg
Dim ans
On Error Resume Next
ans = Application.Match(CLng(Label1.Caption), Range("A:A"), 0)
If Not IsError(ans) Then
Application.Index(Range("B:B"), ans) = Label2.Caption +
ActiveCell.Value
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
What I am trying to achieve is with the Application.Index line
How do I get the two values to add together I have tested the code and it
puts the figures where they should go but what i am trying to make happen is
if the cell already has value in it.
i.e. the cell has 2 in it already and label2 has the value of 5 i want i to
show 7 in the cell.
I believe the following line is the problem
= Label2.Caption + ActiveCell.Value
Thanks
Greg