Kolay gelsin.
Kapalı excel dosyasından veri almak istiyorum ancak aşağıdaki kod hata veriyor. Nerde hata yapıyorum acaba
Private Sub CommandButton1_Click()
Dim w1 As Workbook
Dim s1 As Worksheet
Dim w2 As Workbook
Dim s2 As Worksheet
Set w1 = ThisWorkbook
Set s1 = w1.Worksheets("Sayfa1")
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "C:\Excel"
.Title = "Dosya Seç"
.ButtonName = "Seç bi şey"
.Filters.Clear
.Filters.Add "Excel Files", "*.xlsx, *.csv, *.xls"
.FilterIndex = 1
If .Show = 0 Then
Exit Sub
YGS = .SelectedItems(1)
End If
End With
Application.ScreenUpdating = False
Set w2 = Workbooks.Open(YGS)
Set s2 = w2.Worksheets(1)
s1.Range("A5") = s2.Range("A1")
s1.Range("A6") = s2.Range("B1")
Application.ScreenUpdating = True
w2.Close
End Sub
-
- Destek
-
-
Özel Arama