Meraba arkadaşlar.. Yazdığım programda bir konuya takılıp kaldım, sizlerden yardım almak istedim. Konu başlığından da anlaşıldığı gibi bir exceli güncelleyemiyorum. Elimdeki kod ile sadece yeni excel dosyası olusturabiliyorum.


elimdeki kod:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'verileri datagridden excele aktarıyor.

        Dim a As New SaveFileDialog
        a.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
        a.Title = "Excel’e Export Et"
        a.Filter = "Excel Dosyaları | *.xlsx"
        If a.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim ExcelApp As Excel.Application
            Dim ExcelWorkbook As Excel.Workbook
            Dim ExcelSheet As Excel.Worksheet
            Dim MyFileName As String = Nothing
            MyFileName = a.FileName
            ExcelApp = CreateObject("Excel.Application")
            ExcelWorkbook = ExcelApp.Workbooks.Add
            ExcelSheet = ExcelWorkbook.Worksheets(1)
            ExcelSheet.Cells(1, 1).Value = ""
            ExcelSheet.Cells(1, 2).Value = ""
            ExcelSheet.Cells(1, 3).Value = ""
            ExcelSheet.Cells(1, 4).Value = ""
            ExcelSheet.Cells(1, 5).Value = ""
            ExcelSheet.Cells(1, 6).Value = ""
            ExcelSheet.Cells(1, 7).Value = ""

            ProgressBar1.Maximum = DataGridView1.RowCount - 1

            For yaz = 1 To DataGridView1.RowCount - 1
                ExcelSheet.Cells(yaz + 1, 1).Value = DataGridView1.Rows(yaz - 1).Cells(0).Value & "" '0. kolon
                ExcelSheet.Cells(yaz + 1, 2).Value = DataGridView1.Rows(yaz - 1).Cells(1).Value & "" '1.kolon
                ExcelSheet.Cells(yaz + 1, 3).Value = DataGridView1.Rows(yaz - 1).Cells(2).Value & "" '2.kolon
                ExcelSheet.Cells(yaz + 1, 4).Value = DataGridView1.Rows(yaz - 1).Cells(3).Value & "" '3.kolon
                ExcelSheet.Cells(yaz + 1, 5).Value = DataGridView1.Rows(yaz - 1).Cells(4).Value & "" '4.kolon
                ExcelSheet.Cells(yaz + 1, 6).Value = DataGridView1.Rows(yaz - 1).Cells(5).Value & "" '5.kolon
                ExcelSheet.Cells(yaz + 1, 7).Value = DataGridView1.Rows(yaz - 1).Cells(6).Value & "" '6.kolon
                ProgressBar1.Value = yaz
            Next
            'ExcelWorkbook.SaveAs(MyFileName)
            ExcelWorkbook.Save()
            ExcelWorkbook.Close()
            ExcelApp.Quit()
            ProgressBar1.Value = 0
            MsgBox("Excel Dosyası Oluşturuldu", MsgBoxStyle.Information, "Bilgi")
        End If
    End Sub
Benim istediğim Hatta dosya yolunun bile kod ile gösterip exceli açtırmak ve. datagriddeki yazılanları açılan excele aktarmak.

excelim ise şu sekilde

*** *** **** *** *** *** *** değer değer değer
*** *** **** *** *** *** *** değer değer değer
*** *** **** *** *** *** *** değer değer değer
*** *** **** *** *** *** *** değer değer değer

yani datagridi bu *** lere yerleştirmek istiyorum. Yardımlarınızı bekliyorum.