• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

ThisWorkbook'd a Yazılı Makroyu Çalıştırmak

htsumer

Altın Üye
Altın Üye
Katılım
7 Eylül 2004
Mesajlar
975
Excel Vers. ve Dili
Excel-2003
ThisWorkbook'da aşağıdaki makro buylunmaktadır.Bunu başka bir UserFormda bir buton ile nasıl çalıştırabilriz.

Kod:
Private Sub UnhideSheets()
    Dim sht As Object
    Application.ScreenUpdating = False
    For Each sht In ThisWorkbook.Sheets
        sht.Visible = xlSheetVisible
    Next sht
    ThisWorkbook.Sheets("Macros Disabled").Visible = xlSheetVeryHidden
    Application.ScreenUpdating = True
End Sub
 
Merhaba,

Kodun ismindeki "Private" ifadesini silerseniz istediğiniz yerden kodu çağırabilirsiniz.
 
Alternatif olarak kod:
ThisWorkbook bölümüne

Kod:
Private Sub UnhideSheets()
Dim sht As Object
Application.ScreenUpdating = False
For Each sht In ThisWorkbook.Sheets
sht.Visible = xlSheetVisible
Next sht
ThisWorkbook.Sheets("Macros Disabled").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
End Sub

Sub kodcalistir()
UnhideSheets
End Sub

Userforma

Kod:
Private Sub CommandButton1_Click()
ThisWorkbook.kodcalistir
End Sub
 
Geri
Üst