乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>excel</em> <em>vba</em> 字符串代码如何&

<em>excel</em> <em>vba</em> 字符串代码如何&

作者:乔山办公网日期:

返回目录:excel表格制作


创建zdTextBox1 和CommandButton1
sub CommandButton1_Click()
dim n as integer
dim str as string
n=sheets(1).usedrange.rows.count+1
str=textbox1.text
sheets(1).cells(n,1)=str
end sub

字符串续航一般先把字符串分成几个小字串,用 & 连接,并使用换行符

str="12311231312323" & _
     "dsafasdasdasd"

解决办法如下:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column > 5 Then
Cells(Target.Row + 1, 1).Select
End If
End Sub

上面是>5,即数据输到E列,再往右就会换行

Private Sub ComboBox1_Change()
Sheets("品名").Select
Lable6.Caption = Application.WorksheetFunction _
.VLookup(ComboBox1.Text, Range("A1:B100"), 2, False)
Label5.Caption = Application.WorksheetFunction _
.VLookup(ComboBox1.Text, Range("A1:E100"), 3, False)
TextBox1.Text = ""
TextBox1.SetFocus
Sheets("登记").Select
End Sub

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网