Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Worksheet is replaced
posted

Hi,

I was trying to replace an existing worksheet with a new worksheet. The workbook can't get a worksheet replacement.

For example,

worksheet = Nothing

worksheet = tempworksheet

Please help me as soon as possible

Thanks,

Chi Ming

  • 35319
    posted

    Hello Chi,

     

    I am just checking if you require any further assistance on the matter.

  • 35319
    posted

    Hi Chi,

     

    Thank you for your feedback. I have been looking into your question and I cannot find any issue with the worksheets. The code that I have used for my tests is:

     

            Dim workbook1 As New Workbook()

            Dim worksheet1 = Nothing

            Dim worksheet2 As Worksheet = workbook1.Worksheets.Add("Sheet 1")

            worksheet2.Rows(0).Cells(0).Value = 42

            worksheet1 = worksheet2

     

    Let me know, if I am missing something.