چک باکس

Collapse
این تاپیک قفل است.
X
X
 
  • زمان
  • نمایش
حذف همه
new posts

  • Alireza
    پاسخ داد
    سلام
    این کد رو چک کنید
    کد:
    Sub check()
    
    Dim a As Range
    endrow = Cells(Rows.Count, "N").End(xlUp).Row
    For Each a In Sheet2.Range("G1:N" & endrow)
    If a.Value = True Then
    a.Value = "Èáå"
    Else
     a.Value = "뒄"
    End If
    Next
    
    
    End Sub


    هر موردی هم از قبل ثبت شده باشه اصلاح میشه
    فایل های پیوست شده

    Leave a comment:


  • میثم مقدم نیا
    پاسخ داد
    نوشته اصلی توسط Alireza
    سلام کد ها رو باید اصلاح کنی برای هر چک باکس یک شرط باید داشته باشه


    کد:
    Private Sub CommandButton3_Click()
    '    If CheckForm = False Then
    '    If CheckBox = True Then
    '       MsgBox "áØÝÇð ãæÇÑÏ ãÔÎÕ ÔÏå ÈÇ Ñä ÞÑãÒ ÑÇ Ê˜ãíá äãÇííÏ", vbInformation + vbMsgBoxRight, "ÎØÇ ÏÑ ËÈÊ ÇØáÇÚÇÊ"
    '       Range("G2:N2") = "Èáå"
    '       Exit Sub
    
    
    '    Else
            num = Application.WorksheetFunction.CountA(Range("a:a")) + 1
            Sheets("Sheet2").Cells(num, 4).Value = TextBox1.Value
            Sheets("Sheet2").Cells(num, 5).Value = TextBox2.Value
            Sheets("Sheet2").Cells(num, 1).Value = TextBox3.Value
            Sheets("Sheet2").Cells(num, 3).Value = TextBox4.Value
            Sheets("Sheet2").Cells(num, 6).Value = TextBox5.Value
            Sheets("Sheet2").Cells(num, 2).Value = ComboBox1.Value
            
            If CheckBox1.Value = True Then
            Sheets("Sheet2").Cells(num, 7).Value = "Èáå"
            Else
           Sheets("Sheet2").Cells(num, 7).Value = "뒄"
            End If
            
            If CheckBox2.Value = True Then
            Sheets("Sheet2").Cells(num, 8).Value = "Èáå"
            Else
           Sheets("Sheet2").Cells(num, 8).Value = "뒄"
            End If
            
            
            Sheets("Sheet2").Cells(num, 9).Value = CheckBox3.Value
            Sheets("Sheet2").Cells(num, 10).Value = CheckBox4.Value
            Sheets("Sheet2").Cells(num, 11).Value = CheckBox5.Value
            Sheets("Sheet2").Cells(num, 12).Value = CheckBox6.Value
            Sheets("Sheet2").Cells(num, 13).Value = CheckBox7.Value
            Sheets("Sheet2").Cells(num, 14).Value = CheckBox8.Value
            MsgBox "ÇØáÇÚÇÊ ÈÇ ãæÝÞíÊ ËÈÊ ÔÏ", vbMsgBoxRight, "ËÈÊ ÇØáÇÚÇÊ"
            TextBox1.Value = ""
            TextBox2.Value = ""
            TextBox3.Value = ""
            TextBox4.Value = ""
            TextBox5.Value = ""
            ComboBox1.Value = ""
            CheckBox1.Value = ""
            CheckBox2.Value = ""
            CheckBox3.Value = ""
            CheckBox4.Value = ""
            CheckBox5.Value = ""
            CheckBox6.Value = ""
            CheckBox7.Value = ""
            CheckBox8.Value = ""
    '        Range("G2:N2") = "뒄"
    
    
    '    End If
    End Sub
    مرسی ممنون از راهنمایتون در این نمونه ۸تا چکس باکس قرار داره ولی تو فایل اصلی من تعداد چک باکسهام زیاده مثل پرسش نامه که تمام جواب ها بله و خیر هستند اگه بخوام برای تک تکشون این شرط قرار بده صفحه کد خیلی شلوغ میشه من جای خوندم که میشه با استفاده از ماژول و فرار خانی از اونجا کارار به مراتب سبک کرد ولی متاسفانه یادم نیست که چطوری این کار را بکنم میتونید کمکم کنیدچ

    Leave a comment:


  • Alireza
    پاسخ داد
    سلام کد ها رو باید اصلاح کنی برای هر چک باکس یک شرط باید داشته باشه


    کد:
    Private Sub CommandButton3_Click()
    '    If CheckForm = False Then
    '    If CheckBox = True Then
    '       MsgBox "áØÝÇð ãæÇÑÏ ãÔÎÕ ÔÏå ÈÇ Ñä ÞÑãÒ ÑÇ Ê˜ãíá äãÇííÏ", vbInformation + vbMsgBoxRight, "ÎØÇ ÏÑ ËÈÊ ÇØáÇÚÇÊ"
    '       Range("G2:N2") = "Èáå"
    '       Exit Sub
    
    
    '    Else
            num = Application.WorksheetFunction.CountA(Range("a:a")) + 1
            Sheets("Sheet2").Cells(num, 4).Value = TextBox1.Value
            Sheets("Sheet2").Cells(num, 5).Value = TextBox2.Value
            Sheets("Sheet2").Cells(num, 1).Value = TextBox3.Value
            Sheets("Sheet2").Cells(num, 3).Value = TextBox4.Value
            Sheets("Sheet2").Cells(num, 6).Value = TextBox5.Value
            Sheets("Sheet2").Cells(num, 2).Value = ComboBox1.Value
            
            If CheckBox1.Value = True Then
            Sheets("Sheet2").Cells(num, 7).Value = "Èáå"
            Else
           Sheets("Sheet2").Cells(num, 7).Value = "뒄"
            End If
            
            If CheckBox2.Value = True Then
            Sheets("Sheet2").Cells(num, 8).Value = "Èáå"
            Else
           Sheets("Sheet2").Cells(num, 8).Value = "뒄"
            End If
            
            
            Sheets("Sheet2").Cells(num, 9).Value = CheckBox3.Value
            Sheets("Sheet2").Cells(num, 10).Value = CheckBox4.Value
            Sheets("Sheet2").Cells(num, 11).Value = CheckBox5.Value
            Sheets("Sheet2").Cells(num, 12).Value = CheckBox6.Value
            Sheets("Sheet2").Cells(num, 13).Value = CheckBox7.Value
            Sheets("Sheet2").Cells(num, 14).Value = CheckBox8.Value
            MsgBox "ÇØáÇÚÇÊ ÈÇ ãæÝÞíÊ ËÈÊ ÔÏ", vbMsgBoxRight, "ËÈÊ ÇØáÇÚÇÊ"
            TextBox1.Value = ""
            TextBox2.Value = ""
            TextBox3.Value = ""
            TextBox4.Value = ""
            TextBox5.Value = ""
            ComboBox1.Value = ""
            CheckBox1.Value = ""
            CheckBox2.Value = ""
            CheckBox3.Value = ""
            CheckBox4.Value = ""
            CheckBox5.Value = ""
            CheckBox6.Value = ""
            CheckBox7.Value = ""
            CheckBox8.Value = ""
    '        Range("G2:N2") = "뒄"
    
    
    '    End If
    End Sub
    فایل های پیوست شده

    Leave a comment:


  • میثم مقدم نیا
    پاسخ داد
    نوشته اصلی توسط mmn1000
    سلام
    من وقتی از کد بالا استفاده میکنم اطلاعات من ازسل A تا N ثبت میشند که G تا N با چکس باکس پر میشن ولی همچنان مشکل True و False را دارم
    لطفاً فایل پیوست را ملاحضه و اصلاح فرمایید
    دوستان سی نبود راهنمایی بیشتر بکنه

    Leave a comment:


  • میثم مقدم نیا
    پاسخ داد
    نوشته اصلی توسط Amir Ghasemiyan
    نمیفهمم منظورتون چیه. شما که کد رو نوشتید. علیرضای عزیز هم کد مربوطه رو داد بهتون. فقط کافیه کد رو بذارید وسط کدهاتون

    کد:
    Private Sub CommandButton3_Click()
        If CheckForm = False Then
           MsgBox "لطفاً موارد مشخص شده با رنگ قرمز را تکميل نماييد", vbInformation + vbMsgBoxRight, "خطا در ثبت اطلاعات"
           Range("a1") = "뒄
           Exit Sub
        Else
            num = Application.WorksheetFunction.CountA(Range("a:a")) + 1
            Sheets("Sheet2").Cells(num, 4).Value = TextBox1.Value
            Sheets("Sheet2").Cells(num, 5).Value = TextBox2.Value
            Sheets("Sheet2").Cells(num, 1).Value = TextBox3.Value
            Sheets("Sheet2").Cells(num, 3).Value = TextBox4.Value
            Sheets("Sheet2").Cells(num, 6).Value = TextBox5.Value
            Sheets("Sheet2").Cells(num, 2).Value = ComboBox1.Value
            Sheets("Sheet2").Cells(num, 7).Value = CheckBox1.Value
            Sheets("Sheet2").Cells(num, 8).Value = CheckBox2.Value
            Sheets("Sheet2").Cells(num, 9).Value = CheckBox3.Value
            Sheets("Sheet2").Cells(num, 10).Value = CheckBox4.Value
            Sheets("Sheet2").Cells(num, 11).Value = CheckBox5.Value
            Sheets("Sheet2").Cells(num, 12).Value = CheckBox6.Value
            Sheets("Sheet2").Cells(num, 13).Value = CheckBox7.Value
            Sheets("Sheet2").Cells(num, 14).Value = CheckBox8.Value
            MsgBox "اطلاعات با موفقيت ثبت شد", vbMsgBoxRight, "ثبت اطلاعات"
            TextBox1.Value = ""
            TextBox2.Value = ""
            TextBox3.Value = ""
            TextBox4.Value = ""
            TextBox5.Value = ""
            ComboBox1.Value = ""
            CheckBox1.Value = ""
            CheckBox2.Value = ""
            CheckBox3.Value = ""
            CheckBox4.Value = ""
            CheckBox5.Value = ""
            CheckBox6.Value = ""
            CheckBox7.Value = ""
            CheckBox8.Value = ""
            Range("a1") = "Èáå" 
        End If
    End Sub
    سلام
    من وقتی از کد بالا استفاده میکنم اطلاعات من ازسل A تا N ثبت میشند که G تا N با چکس باکس پر میشن ولی همچنان مشکل True و False را دارم
    لطفاً فایل پیوست را ملاحضه و اصلاح فرمایید
    فایل های پیوست شده

    Leave a comment:


  • Amir Ghasemiyan
    پاسخ داد
    نمیفهمم منظورتون چیه. شما که کد رو نوشتید. علیرضای عزیز هم کد مربوطه رو داد بهتون. فقط کافیه کد رو بذارید وسط کدهاتون

    کد:
    Private Sub CommandButton3_Click()
        If CheckForm = False Then
           MsgBox "لطفاً موارد مشخص شده با رنگ قرمز را تکميل نماييد", vbInformation + vbMsgBoxRight, "خطا در ثبت اطلاعات"
           Range("a1") = "뒄
           Exit Sub
        Else
            num = Application.WorksheetFunction.CountA(Range("a:a")) + 1
            Sheets("Sheet2").Cells(num, 4).Value = TextBox1.Value
            Sheets("Sheet2").Cells(num, 5).Value = TextBox2.Value
            Sheets("Sheet2").Cells(num, 1).Value = TextBox3.Value
            Sheets("Sheet2").Cells(num, 3).Value = TextBox4.Value
            Sheets("Sheet2").Cells(num, 6).Value = TextBox5.Value
            Sheets("Sheet2").Cells(num, 2).Value = ComboBox1.Value
            Sheets("Sheet2").Cells(num, 7).Value = CheckBox1.Value
            Sheets("Sheet2").Cells(num, 8).Value = CheckBox2.Value
            Sheets("Sheet2").Cells(num, 9).Value = CheckBox3.Value
            Sheets("Sheet2").Cells(num, 10).Value = CheckBox4.Value
            Sheets("Sheet2").Cells(num, 11).Value = CheckBox5.Value
            Sheets("Sheet2").Cells(num, 12).Value = CheckBox6.Value
            Sheets("Sheet2").Cells(num, 13).Value = CheckBox7.Value
            Sheets("Sheet2").Cells(num, 14).Value = CheckBox8.Value
            MsgBox "اطلاعات با موفقيت ثبت شد", vbMsgBoxRight, "ثبت اطلاعات"
            TextBox1.Value = ""
            TextBox2.Value = ""
            TextBox3.Value = ""
            TextBox4.Value = ""
            TextBox5.Value = ""
            ComboBox1.Value = ""
            CheckBox1.Value = ""
            CheckBox2.Value = ""
            CheckBox3.Value = ""
            CheckBox4.Value = ""
            CheckBox5.Value = ""
            CheckBox6.Value = ""
            CheckBox7.Value = ""
            CheckBox8.Value = ""
            Range("a1") = "Èáå" 
        End If
    End Sub

    Leave a comment:


  • میثم مقدم نیا
    پاسخ داد
    دوستان کسی نبود راهنمایم کنه

    Leave a comment:


  • میثم مقدم نیا
    پاسخ داد
    نوشته اصلی توسط Alireza
    سلام
    میتونید از یک شرط استفاده کنید
    کد PHP:
    Private Sub CommandButton1_Click()
    If 
    CheckBox1 = True Then
    Range
    ("a1") = "Èáå" 
    Else 
    Range("a1") = "ÎíÑ

    End IfEnd Sub 
    مرسی استاد عزیز
    اگه من بخوام این را در کد
    کد PHP:
    Private Sub CommandButton3_Click()
        If 
    CheckForm = False Then
           MsgBox 
    "لطفاً موارد مشخص شده با رنگ قرمز را تکميل نماييد", vbInformation + vbMsgBoxRight, "خطا در ثبت اطلاعات"
           
    Exit Sub
        
    Else
            
    num = Application.WorksheetFunction.CountA(Range("a:a")) + 1
            Sheets
    ("Sheet2").Cells(num, 4).Value = TextBox1.Value
            Sheets
    ("Sheet2").Cells(num, 5).Value = TextBox2.Value
            Sheets
    ("Sheet2").Cells(num, 1).Value = TextBox3.Value
            Sheets
    ("Sheet2").Cells(num, 3).Value = TextBox4.Value
            Sheets
    ("Sheet2").Cells(num, 6).Value = TextBox5.Value
            Sheets
    ("Sheet2").Cells(num, 2).Value = ComboBox1.Value
            Sheets
    ("Sheet2").Cells(num, 7).Value = CheckBox1.Value
            Sheets
    ("Sheet2").Cells(num, 8).Value = CheckBox2.Value
            Sheets
    ("Sheet2").Cells(num, 9).Value = CheckBox3.Value
            Sheets
    ("Sheet2").Cells(num, 10).Value = CheckBox4.Value
            Sheets
    ("Sheet2").Cells(num, 11).Value = CheckBox5.Value
            Sheets
    ("Sheet2").Cells(num, 12).Value = CheckBox6.Value
            Sheets
    ("Sheet2").Cells(num, 13).Value = CheckBox7.Value
            Sheets
    ("Sheet2").Cells(num, 14).Value = CheckBox8.Value
            MsgBox 
    "اطلاعات با موفقيت ثبت شد", vbMsgBoxRight, "ثبت اطلاعات"
            
    TextBox1.Value = ""
            
    TextBox2.Value = ""
            
    TextBox3.Value = ""
            
    TextBox4.Value = ""
            
    TextBox5.Value = ""
            
    ComboBox1.Value = ""
            
    CheckBox1.Value = ""
            
    CheckBox2.Value = ""
            
    CheckBox3.Value = ""
            
    CheckBox4.Value = ""
            
    CheckBox5.Value = ""
            
    CheckBox6.Value = ""
            
    CheckBox7.Value = ""
            
    CheckBox8.Value = ""
        
    End If
    End Sub 
    استفاده کنم به چه صورتی میشه

    Leave a comment:


  • Amir Ghasemiyan
    پاسخ داد
    سلام دوست عزيز

    بله خيلي راحته. كافيه يك if بذاريد. بگيد اگر مقدار چك باكس true بود بنويس بله وگرنه بنويس خير

    Leave a comment:


  • Alireza
    پاسخ داد
    سلام
    میتونید از یک شرط استفاده کنید
    کد PHP:
    Private Sub CommandButton1_Click()
    If 
    CheckBox1 = True Then
    Range
    ("a1") = "Èáå" 
    Else 
    Range("a1") = "ÎíÑ

    End IfEnd Sub 
    فایل های پیوست شده

    Leave a comment:


  • میثم مقدم نیا
    یک موضوع ایجاد کرد [حل شده] چک باکس

    چک باکس

    سلام
    آیا امکانش هست وقتی که تو یوزرفرم تیک چک باکس را میزنیم بعد از زدن کلید ثبت به جای ثبت شدن True و False در سلول از بله یا خیر استفاده کرد
    ممنون میشم اگه راهنمایم کنید اگه امکانش هست با مثال توضیح دهید
    با تشکر از کلیه دوستان و اساتید اکسل ایران
چند لحظه..