- Katılım
- 14 Haziran 2005
- Mesajlar
- 196
- Excel Vers. ve Dili
- Office 365, Office 2019
Aşağıdaki kodu yazıp başka bir kitap sayfasından veri aldığımda güncelleme soruyor , istiyorumki kopyalamada sadece değer kaydetsin, güncellenecek verileri sormasın
Private Sub CommandButton30_Click()
YesNo = MsgBox(" Bilgisayarın D bölümündeki DATA.xls adlı dosyadan (D:\DATA.xls) bilgileri güncellemek istermisiniz?", vbYesNo)
Select Case YesNo
Case vbNo
Exit Sub
Case vbYes
'dış veri almak için için
On Error GoTo ERR
Dim wb As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb = Workbooks.Open("d:\DATA.xls", True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("DATA")
' read data from the source workbook
.Range("A2", "BD100").Formula = wb.Worksheets("DATA").Range("A2", "BD100").Formula
End With
wb.Close False ' close the source workbook without saving any changes
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating
MsgBox "Bilgileriniz başarıyla güncellendi", vbInformation
End Select
ERR:
If ERR Then
MsgBox "D Bölümünde DATA.xls dosyası bulunamadı", vbInformation
End If
End Sub
Private Sub CommandButton30_Click()
YesNo = MsgBox(" Bilgisayarın D bölümündeki DATA.xls adlı dosyadan (D:\DATA.xls) bilgileri güncellemek istermisiniz?", vbYesNo)
Select Case YesNo
Case vbNo
Exit Sub
Case vbYes
'dış veri almak için için
On Error GoTo ERR
Dim wb As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb = Workbooks.Open("d:\DATA.xls", True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("DATA")
' read data from the source workbook
.Range("A2", "BD100").Formula = wb.Worksheets("DATA").Range("A2", "BD100").Formula
End With
wb.Close False ' close the source workbook without saving any changes
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating
MsgBox "Bilgileriniz başarıyla güncellendi", vbInformation
End Select
ERR:
If ERR Then
MsgBox "D Bölümünde DATA.xls dosyası bulunamadı", vbInformation
End If
End Sub
