Board logo

標題: vba語法簡化,求助 [打印本頁]

作者: pcimo2468    時間: 2018-9-11 23:54     標題: vba語法簡化,求助

:dizzy: 請問一下各位大大

下面語法要如何簡化,好多好長

If cb1.Text = "" Then
    sln1 = cb1.Text
Else
    sln1 = cb1.Text + " "
End If
    If time1.Text = "" Then
    slt1 = time1.Text
Else
    slt1 = time1.Text + "次 "
End If
    If tb1.Text = "" Then
    slm1 = tb1.Text
Else
    slm1 = tb1.Text + "M "
End If

    If cb2.Text = "" Then
    sln2 = cb2.Text
Else
    sln2 = cb2.Text + " "
End If
    If time2.Text = "" Then
    slt2 = time2.Text
Else
    slt2 = time2.Text + "次 "
End If
    If tb2.Text = "" Then
    slm2 = tb2.Text
Else
    slm2 = tb2.Text + "M "
End If

    If cb3.Text = "" Then
    sln3 = cb3.Text
Else
    sln3 = cb3.Text + " "
End If
    If time3.Text = "" Then
    slt3 = time3.Text
Else
    slt3 = time3.Text + "次 "
End If
    If tb3.Text = "" Then
    slm3 = tb3.Text
Else
    slm3 = tb3.Text + "M "
End If




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)