+ Reply to Thread
Results 1 to 10 of 10

Writing option button data to specific cell in a table

Hybrid View

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    bergen county, NJ
    MS-Off Ver
    Excel 2007
    Posts
    72

    Re: Writing option button data to specific cell in a table

    the code works when i'm entering in data from the text box... i'm able to select either sheet, and then fill in the appropriate cell with the info obtained from the comboboxes... when i try it with the option buttons it gets tripped up (as do I )

  2. #2
    Registered User
    Join Date
    11-08-2011
    Location
    bergen county, NJ
    MS-Off Ver
    Excel 2007
    Posts
    72

    Re: Writing option button data to specific cell in a table

    ok, it's kind of working now... i realized i had cut and pasted some code from another attempt, and neglected to change the names... so the code pasted here is allowing me to enter the score corresponding to the correct option button, however, it's not letting me post to "student3" sheet... when student 3 is selected it is putting the data in "student1" sheet

    Private Sub CommandButton1_Click()
    Dim gradesheet As Worksheet
    Dim where1 As Range, where2 As Range
    
    Set gradesheet = ThisWorkbook.Worksheets(ComboBox3.Value)
    
    Set where1 = gradesheet.Range("A:A").Find(what:=ComboBox1.Value)
    Set where2 = gradesheet.Range("1:1").Find(what:=ComboBox2.Value)
    
    'gradesheet.Cells(where1.Row, where2.Column) = TextBox1.Value
    
    If Frame1.opt60.Value = True Then
         gradesheet.Cells(where1.Row, where2.Column) = 60
    
    ElseIf Frame1.opt65.Value = True Then
         gradesheet.Cells(where1.Row, where2.Column).Value = 65
         
    ElseIf Frame1.opt70.Value = True Then
       gradesheet.Cells(where1.Row, where2.Column).Value = 70
        
    ElseIf Frame1.opt75.Value = True Then
        gradesheet.Cells(where1.Row, where2.Column).Value = 75
        
    ElseIf Frame1.opt80.Value = True Then
      gradesheet.Cells(where1.Row, where2.Column).Value = 80
        
    ElseIf Frame1.opt85.Value = True Then
       gradesheet.Cells(where1.Row, where2.Column).Value = 85
        
    ElseIf Frame1.opt90.Value = True Then
       gradesheet.Cells(where1.Row, where2.Column).Value = 90
       
    ElseIf Frame1.opt95.Value = True Then
      gradesheet.Cells(where1.Row, where2.Column).Value = 95
      
    ElseIf Frame1.opt100.Value = True Then
        gradesheet.Cells(where1.Row, where2.Column).Value = 100
    End If
    
    
    
    End Sub
    
    
    
    Private Sub UserForm_Initialize()
    
    Dim ws As Worksheet
    For Each ws In Worksheets
        ComboBox3.AddItem ws.Name
        Next ws
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1