• DİKKAT

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

Sayfadaki kodu bir düğmeye aktarmak

Katılım
5 Ocak 2009
Mesajlar
1,586
Excel Vers. ve Dili
2003 Türkçe
Selam,
Aşağıdakikodu hücre biçimlendirmede kullanıyorum. Kodlar ilgili sayfada bulunuyor.
Ben sayfaya birtane düğme koyup o düğmeye tıklayınca makro çalışmasını istiyorum.
Ben yapamadım. Yardımcı olursanız çok sevinirim.

Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim HÜCRE As Range
    
    If Intersect(Target, Range("a1:e10000")) Is Nothing Then Exit Sub
    
    On Error Resume Next
    
     Application.ScreenUpdating = True
     
    For Each HÜCRE In Range(Cells(1, Target.Column), Cells(10000, Target.Column))
        If HÜCRE.Column = 4 Then
        If HÜCRE.Value >= 1 And HÜCRE.Value <= 10 Then HÜCRE.NumberFormat = "#,## ""Yıllık"""
        If HÜCRE.Value >= 50 And HÜCRE.Value <= 15000 Then HÜCRE.NumberFormat = "#,## ""Saatlik"""
        If HÜCRE.Value >= 16000 And HÜCRE.Value <= 500000 Then HÜCRE.NumberFormat = "#,## ""Paket"""
        If HÜCRE.Value >= 10000000 And HÜCRE.Value <= 40000000 Then HÜCRE.NumberFormat = "#,## ""İnsört"""
    
             
        ElseIf HÜCRE.Column = 5 Then
        If HÜCRE.Value > 0 And HÜCRE.Value <= 320000 Then HÜCRE.NumberFormat = "#,## ""Saat"""
        If HÜCRE.Value > 320000 And HÜCRE.Value < 10900000 Then HÜCRE.NumberFormat = "#,## ""Paket"""
        If HÜCRE.Value > 10900000 And HÜCRE.Value < 500000000 Then HÜCRE.NumberFormat = "#,## ""İnsört"""
        End If
    Next
 Application.ScreenUpdating = False
End Sub
 
Merhaba,

Dosya olmadığı için deneme fırsatım olmadı.

Module kopyalayın ve bir butona bağlayarak çalıştırın..

Kod:
Sub Düzenle()
Dim hücre As Range
On Error Resume Next
Application.ScreenUpdating = True
    For Each hücre In Range("a1:e10000")
        If hücre.Column = 4 Then
            If hücre.Value >= 1 And hücre.Value <= 10 Then hücre.NumberFormat = "#,## ""Yıllık"""
            If hücre.Value >= 50 And hücre.Value <= 15000 Then hücre.NumberFormat = "#,## ""Saatlik"""
            If hücre.Value >= 16000 And hücre.Value <= 500000 Then hücre.NumberFormat = "#,## ""Paket"""
            If hücre.Value >= 10000000 And hücre.Value <= 40000000 Then hücre.NumberFormat = "#,## ""İnsört"""
         
        ElseIf hücre.Column = 5 Then
            If hücre.Value > 0 And hücre.Value <= 320000 Then hücre.NumberFormat = "#,## ""Saat"""
            If hücre.Value > 320000 And hücre.Value < 10900000 Then hücre.NumberFormat = "#,## ""Paket"""
            If hücre.Value > 10900000 And hücre.Value < 500000000 Then hücre.NumberFormat = "#,## ""İnsört"""
        End If
    Next
 Application.ScreenUpdating = False
End Sub

.
 
Form düğmesi ekledim. Çalıştı.
Çok teşekkürler Sayın ÖMER.
ellerinize sağlık.
 
Geri
Üst