Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Wierd error at VBA -> Excel content transfer

[b][red]This message was edited by obi_k at 2004-3-5 8:1:25[/red][/b][hr]
I'm writing a macro program for ExcelXP in VBA. I'm working only in one worksheet, whose conents change depending on the status of a pair of radio buttons, so i tried to write a procedure to create the contents of the cells that change (the contents consist of XL formulae). The problem is that when I try to run the program, it gives an error message dialog w/ the 1004 error code: 'Application-defined or user-defined error'. What's up with that? I didn't write any error-handling code! Here's the code for that procedure. Tell me if you see anything wrong with it!

Private Sub Init_XL(Tip As String)
Dim i As Integer
Dim content As String * 20
If Tip = "Factura" Then
For i = 8 To 14
content = "=IF(C" & CStr(i) & "<>0;C" & CStr(i) & "*D" & CStr(i) & ";" & """" & " " & """" & ")"
Main.Cells(i, 5).Value = content
Next i
End If
End Sub

When I step into the program, the 'content' variable takes the value '=IF(C8<>0;C8*D8;" ")' , as it should, but when I assign it to the .value property of the cell, i get the error message. What should I do? 10x.



Sign In or Register to comment.