返回列表 上一主題 發帖

vba語法簡化,求助

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

        靜思自在 : 甘願做、歡喜受。
返回列表 上一主題