Question Swapping Cell comments with cell values error

gta18

New member
Joined
Feb 7, 2014
Messages
2
Programming Experience
Beginner
Hi guys,

my first post here. I need your help.

i am getting this "Member not Found" error everytime the loop sees an empty cell..


What am I missing?

Thanks!


VB.NET:
    Private Sub SwitchCommentButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SwitchCommentButton.Click
        Dim mycell
        'Dim tempValue1 As String
        'Dim tempValue2 As String


        objBook = System.Runtime.InteropServices.Marshal.BindToMoniker(FileNameDisp.Text) '("C:\Documents and Settings\agregorio\My Documents\GooGle Drive A.G\Personal\Programming\VB studio express\PLC SIMULATOR BETA\sim1.xlsx")
        objApp = objBook.Parent


        Dim tempValue1


        Dim tempValue2


        'tempValue1 = New Object


        'tempValue2 = New Object


        objApp.Application.Visible = 1
        For Each mycell In objApp.Selection
            tempValue1 = mycell.value
            tempValue2 = mycell.COMMENT
            If tempValue2 Is Nothing Then
            Else
                mycell.value = tempValue2
            End If
            If tempValue1 Is Nothing Then
            Else
[SIZE=5][COLOR=#ff0000]                mycell.notetext(tempValue1)[/COLOR][/SIZE]


            End If
            
        Next


        releaseObject(objApp)
        releaseObject(objBook)
        releaseObject(objBooks)
    End Sub
End Class
 
Last edited:
Top Bottom