Shorter VBA code, help

voda4444

New Member
Joined
Nov 23, 2017
Messages
7
Hi!

Can anyone please help me write a shorter vba code?

This vba code I need for editing futsal players records.

That vba code works well, but it's too long.

The code below is short example because its too long. But I have in league 10 teams, so I would like a better solution.

Thank you in advance for your help.

Kind Regards
--Daniel



Code:
<code>Private Sub OptionButton1_Click()

    txtBox1.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A2").Value
    txtBox2.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B2").Value
    txtBox3.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A3").Value
    txtBox4.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B3").Value
    txtBox5.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A4").Value
    txtBox6.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B4").Value
    txtBox7.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A5").Value
    txtBox8.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B5").Value
    txtBox9.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A6").Value
    txtBox10.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B6").Value
    txtBox11.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A7").Value
    txtBox12.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B7").Value
    txtBox13.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A8").Value
    txtBox14.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B8").Value
    txtBox15.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A9").Value
    txtBox16.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B9").Value
    txtBox17.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A10").Value
    txtBox18.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B10").Value
    txtBox19.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A11").Value
    txtBox20.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B11").Value
    txtBox21.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A12").Value
    txtBox22.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B12").Value
    txtBox23.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A13").Value
    txtBox24.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B13").Value
    txtBox25.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A14").Value
    txtBox26.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B14").Value
    txtBox27.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A15").Value
    txtBox28.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B15").Value
    txtBox29.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A16").Value
    txtBox30.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B16").Value
    txtBox31.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A17").Value
    txtBox32.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B17").Value
    txtBox33.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A18").Value
    txtBox34.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B18").Value
    txtBox35.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A19").Value
    txtBox36.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B19").Value
    txtBox37.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A20").Value
    txtBox38.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B20").Value
    txtBox39.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A21").Value
    txtBox40.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B21").Value
    txtBox41.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A22").Value
    txtBox42.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B22").Value
    txtBox43.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A23").Value
    txtBox44.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B23").Value
    txtBox45.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A24").Value
    txtBox46.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B24").Value
    txtBox47.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A25").Value
    txtBox48.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B25").Value
    txtBox49.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("A26").Value
    txtBox50.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("B26").Value

End Sub

Private Sub OptionButton2_Click()

    txtBox1.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C2").Value
    txtBox2.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D2").Value
    txtBox3.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C3").Value
    txtBox4.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D3").Value
    txtBox5.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C4").Value
    txtBox6.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D4").Value
    txtBox7.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C5").Value
    txtBox8.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D5").Value
    txtBox9.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C6").Value
    txtBox10.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D6").Value
    txtBox11.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C7").Value
    txtBox12.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D7").Value
    txtBox13.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C8").Value
    txtBox14.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D8").Value
    txtBox15.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C9").Value
    txtBox16.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D9").Value
    txtBox17.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C10").Value
    txtBox18.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D10").Value
    txtBox19.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C11").Value
    txtBox20.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D11").Value
    txtBox21.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C12").Value
    txtBox22.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D12").Value
    txtBox23.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C13").Value
    txtBox24.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D13").Value
    txtBox25.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C14").Value
    txtBox26.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D14").Value
    txtBox27.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C15").Value
    txtBox28.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D15").Value
    txtBox29.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C16").Value
    txtBox30.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D16").Value
    txtBox31.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C17").Value
    txtBox32.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D17").Value
    txtBox33.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C18").Value
    txtBox34.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D18").Value
    txtBox35.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C19").Value
    txtBox36.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D19").Value
    txtBox37.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C20").Value
    txtBox38.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D20").Value
    txtBox39.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C21").Value
    txtBox40.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D21").Value
    txtBox41.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C22").Value
    txtBox42.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D22").Value
    txtBox43.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C23").Value
    txtBox44.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D23").Value
    txtBox45.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C24").Value
    txtBox46.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D24").Value
    txtBox47.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C25").Value
    txtBox48.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D25").Value
    txtBox49.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("C26").Value
    txtBox50.Text = ThisWorkbook.Sheets("soupisky_tymu").Range("D26").Value

End Sub

Private Sub CommandButton1_Click()

    txtBox2.Text = Format(txtBox2, "dd.mm.yyyy")
    txtBox4.Text = Format(txtBox4, "dd.mm.yyyy")
    txtBox6.Text = Format(txtBox6, "dd.mm.yyyy")
    txtBox8.Text = Format(txtBox8, "dd.mm.yyyy")
    txtBox10.Text = Format(txtBox10, "dd.mm.yyyy")
    txtBox12.Text = Format(txtBox12, "dd.mm.yyyy")
    txtBox14.Text = Format(txtBox14, "dd.mm.yyyy")
    txtBox16.Text = Format(txtBox16, "dd.mm.yyyy")
    txtBox18.Text = Format(txtBox18, "dd.mm.yyyy")
    txtBox20.Text = Format(txtBox20, "dd.mm.yyyy")
    txtBox22.Text = Format(txtBox22, "dd.mm.yyyy")
    txtBox24.Text = Format(txtBox24, "dd.mm.yyyy")
    txtBox26.Text = Format(txtBox26, "dd.mm.yyyy")
    txtBox28.Text = Format(txtBox28, "dd.mm.yyyy")
    txtBox30.Text = Format(txtBox30, "dd.mm.yyyy")
    txtBox32.Text = Format(txtBox32, "dd.mm.yyyy")
    txtBox34.Text = Format(txtBox34, "dd.mm.yyyy")
    txtBox36.Text = Format(txtBox36, "dd.mm.yyyy")
    txtBox38.Text = Format(txtBox38, "dd.mm.yyyy")
    txtBox40.Text = Format(txtBox40, "dd.mm.yyyy")
    txtBox42.Text = Format(txtBox42, "dd.mm.yyyy")
    txtBox44.Text = Format(txtBox44, "dd.mm.yyyy")
    txtBox46.Text = Format(txtBox46, "dd.mm.yyyy")
    txtBox48.Text = Format(txtBox48, "dd.mm.yyyy")
    txtBox50.Text = Format(txtBox50, "dd.mm.yyyy")

If OptionButton1 = True Then

    ThisWorkbook.Sheets("soupisky_tymu").Range("A2:B26").ClearContents
    
    ThisWorkbook.Sheets("soupisky_tymu").Range("A2").Value = txtBox1.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B2").Value = txtBox2.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A3").Value = txtBox3.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B3").Value = txtBox4.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A4").Value = txtBox5.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B4").Value = txtBox6.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A5").Value = txtBox7.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B5").Value = txtBox8.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A6").Value = txtBox9.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B6").Value = txtBox10.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A7").Value = txtBox11.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B7").Value = txtBox12.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A8").Value = txtBox13.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B8").Value = txtBox14.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A9").Value = txtBox15.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B9").Value = txtBox16.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A10").Value = txtBox17.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B10").Value = txtBox18.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A11").Value = txtBox19.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B11").Value = txtBox20.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A12").Value = txtBox21.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B12").Value = txtBox22.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A13").Value = txtBox23.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B13").Value = txtBox24.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A14").Value = txtBox25.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B14").Value = txtBox26.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A15").Value = txtBox27.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B15").Value = txtBox28.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A16").Value = txtBox29.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B16").Value = txtBox30.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A17").Value = txtBox31.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B17").Value = txtBox32.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A18").Value = txtBox33.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B18").Value = txtBox34.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A19").Value = txtBox35.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B19").Value = txtBox36.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A20").Value = txtBox37.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B20").Value = txtBox38.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A21").Value = txtBox39.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B21").Value = txtBox40.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A22").Value = txtBox41.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B22").Value = txtBox42.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A23").Value = txtBox43.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B23").Value = txtBox44.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A24").Value = txtBox45.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B24").Value = txtBox46.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A25").Value = txtBox47.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B25").Value = txtBox48.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("A26").Value = txtBox49.Text
    ThisWorkbook.Sheets("soupisky_tymu").Range("B26").Value = txtBox50.Text

    OptionButton1.Value = False

    txtBox1.Text = ""
    txtBox2.Text = ""
    txtBox3.Text = ""
    txtBox4.Text = ""
    txtBox5.Text = ""
    txtBox6.Text = ""
    txtBox7.Text = ""
    txtBox8.Text = ""
    txtBox9.Text = ""
    txtBox10.Text = ""
    txtBox11.Text = ""
    txtBox12.Text = ""
    txtBox13.Text = ""
    txtBox14.Text = ""
    txtBox15.Text = ""
    txtBox16.Text = ""
    txtBox17.Text = ""
    txtBox18.Text = ""
    txtBox19.Text = ""
    txtBox20.Text = ""
    txtBox21.Text = ""
    txtBox22.Text = ""
    txtBox23.Text = ""
    txtBox24.Text = ""
    txtBox25.Text = ""
    txtBox26.Text = ""
    txtBox27.Text = ""
    txtBox28.Text = ""
    txtBox29.Text = ""
    txtBox30.Text = ""
    txtBox31.Text = ""
    txtBox32.Text = ""
    txtBox33.Text = ""
    txtBox34.Text = ""
    txtBox35.Text = ""
    txtBox36.Text = ""
    txtBox37.Text = ""
    txtBox38.Text = ""
    txtBox39.Text = ""
    txtBox40.Text = ""
    txtBox41.Text = ""
    txtBox42.Text = ""
    txtBox43.Text = ""
    txtBox44.Text = ""
    txtBox45.Text = ""
    txtBox46.Text = ""
    txtBox47.Text = ""
    txtBox48.Text = ""
    txtBox49.Text = ""
    txtBox50.Text = ""


End If

End Sub

Private Sub CommandButton2_Click()

    Unload UserForm3
    
End Sub</code>
 

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
436
voda

The code below would replace your code for OptionButton1_Click(). Hopefully this will work and from that you can rebuild your other OptionButton code modules.
Let me know if you don't understand the code and I will provide a detailed explanation.

Private Sub OptionButton1_Click()


Dim x As Long
Dim y As Long
Dim z As Long
Dim txtbox As String


x = 1
r = 1
c = 1


Do Until x = 50
txtbox = "txtBox" & x
Do Until r = 26
txtbox.Text = ThisWorkbook.Sheets("soupisky_tymu").Range(Cells(r, c)).Value
If c = 1 Then
c = 2
Else
c = 1
End If
Loop
Loop


End Sub
 

voda4444

New Member
Joined
Nov 23, 2017
Messages
7
Thank you for help.

This is final code.

Code:
Private Sub OptionButton1_Click()

    FillPlayers "A"

End Sub

Private Sub OptionButton2_Click()

    FillPlayers "C"

End Sub
Private Sub OptionButton3_Click()

    FillPlayers "E"

End Sub
Private Sub OptionButton4_Click()

    FillPlayers "G"

End Sub
Private Sub OptionButton5_Click()

    FillPlayers "I"

End Sub
Private Sub OptionButton6_Click()

    FillPlayers "K"

End Sub
Private Sub OptionButton7_Click()

    FillPlayers "M"

End Sub
Private Sub OptionButton8_Click()

    FillPlayers "O"

End Sub
Private Sub OptionButton9_Click()

    FillPlayers "Q"

End Sub
Private Sub OptionButton10_Click()

    FillPlayers "S"

End Sub

Private Sub CommandButton1_Click()

    formatDateBoxes
    If OptionButton1 = True Then
    
        outputPlayers "A"
    
        OptionButton1.Value = False
    
        clearTextboxes
    
    ElseIf OptionButton2 = True Then
    
        outputPlayers "C"
        
        OptionButton2.Value = False
        
        clearTextboxes
    
    ElseIf OptionButton3 = True Then
    
        outputPlayers "E"
        
        OptionButton3.Value = False
        
        clearTextboxes
    
    ElseIf OptionButton4 = True Then
    
        outputPlayers "G"
        
        OptionButton4.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton5 = True Then
    
        outputPlayers "I"
        
        OptionButton5.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton6 = True Then
    
        outputPlayers "K"
        
        OptionButton6.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton7 = True Then
    
        outputPlayers "M"
        
        OptionButton7.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton8 = True Then
    
        outputPlayers "O"
        
        OptionButton8.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton9 = True Then
    
        outputPlayers "Q"
        
        OptionButton9.Value = False
        
        clearTextboxes
        
    ElseIf OptionButton10 = True Then
    
        outputPlayers "S"
        
        OptionButton10.Value = False
        
        clearTextboxes
        
        
    End If

End Sub

Private Sub CommandButton2_Click()

    Unload UserForm3
    
End Sub
Sub FillPlayers(startCol)
    Dim n As Long
    Dim dataRange As Range
    
    Set dataRange = ThisWorkbook.Sheets("soupisky_tymu").Cells(2, startCol).Resize(25, 2)
    For n = 1 To 50
        Me.Controls("txtBox" & n).Text = dataRange.Cells(n).Value
    Next n

End Sub
Sub outputPlayers(startCol)
    Dim n As Long
    Dim dataRange As Range
    
    Set dataRange = ThisWorkbook.Sheets("soupisky_tymu").Cells(2, startCol).Resize(25, 2)
    dataRange.ClearContents
    For n = 1 To 50
        dataRange.Cells(n).Value = Me.Controls("txtBox" & n).Text
    Next n

End Sub

Sub clearTextboxes()
    Dim n As Long
    For n = 1 To 50
        Me.Controls("txtBox" & n).Text = vbNullString
    Next n
End Sub
Sub formatDateBoxes()
    Dim n As Long
    For n = 2 To 50 Step 2
        Me.Controls("txtBox" & n).Text = Format$(Me.Controls("txtBox" & n).Text, "dd.mm.yyyy")
    Next n

End Sub


Private Sub userform_initialize()
    
With UserForm3

    OptionButton1.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 2)
    OptionButton2.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 3)
    OptionButton3.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 4)
    OptionButton4.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 5)
    OptionButton5.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 6)
    OptionButton6.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 7)
    OptionButton7.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 8)
    OptionButton8.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 9)
    OptionButton9.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 10)
    OptionButton10.Caption = ThisWorkbook.Sheets("soupisky_tymu").Cells(30, 11)

End With
    
End Sub
 

Forum statistics

Threads
1,082,126
Messages
5,363,315
Members
400,725
Latest member
excelingtolearn

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top