おはよう!私のワークシートには(1) textbox as TextBox1
と1 button for submit button.
があります。出力として分割されたテキストを与えるサンプルコードがあります。テキストボックス1に重複した単語があり、ユーザーが送信ボタンを入力するとワークシート(DatabaseStorage)に保存され、categorize the output
はNo Duplicated Word
からduplicated Word
に保存されます。この2つの異なるフィールドは、システムの一部の機能に必要となるためです。重複したデータをVBAの異なる列に挿入する
Private Sub CommandButton1_Click()
Call SplitText
End Sub
Sub SplitText()
Dim WArray As Variant
Dim TextString As String
TextString = TextBox1
WArray = Split(TextBox1, " ")
If (TextString = "") Then
MsgBox ("Error: Pls Enter your data")
Else
With Sheets("DatabaseStorage")
.Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(UBound(WArray) + IIf(LBound(WArray) = 0, 1, 0)) = Application.Transpose(WArray)
End With
MsgBox ("Successfully inserted")
End If
End Sub
テキストボックスにどのようにデータを入力するかについて少し詳しく説明できますか?箱に1行に1語はありますか? – kschindl
こんにちは私はすでに新しい画像をチェックして更新しました。あなたは答えが必要ですが、列に予期しない出力があります。 "重複する単語がありません"という単語があります。上記の例のように –