国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

【實(shí)例13-分割數(shù)據(jù)至多個(gè)單元格】【實(shí)例14-合并多個(gè)單元格數(shù)據(jù)】Excel表格VBA編程實(shí)例

2023-02-27 00:56 作者:凌霄百科_Excel辦公程序  | 我要投稿

實(shí)例13-分割數(shù)據(jù)至多個(gè)單元格

Private Sub CommandButton分割數(shù)據(jù)_Click()

'分割符號(hào)不能為空

With ThisWorkbook.Worksheets("操作界面")

Dim splittext As String

If .Cells(5, "C").Value <> "" Then

splittext = .Cells(5, "C").Value

Else

MsgBox "請輸入分割符號(hào)"

Exit Sub

End If

'處理內(nèi)容不能為空

Dim splitcontent As String

If .Cells(8, "B").Value <> "" Then

splitcontent = .Cells(8, "B").Value

Else

MsgBox "請輸入處理內(nèi)容"

Exit Sub

End If

End With

'清除處理結(jié)果

With ThisWorkbook.Worksheets("處理結(jié)果")

.Columns(1).ClearFormats

.Columns(1).ClearContents

'分割數(shù)據(jù)

Dim split_array

split_array = Split(splitcontent, splittext)

Dim i

For i = 0 To UBound(split_array)

.Cells(i + 1, 1).Value = split_array(i)

Next i

.Activate

End With

End Sub

實(shí)例14-合并多個(gè)單元格數(shù)據(jù)

Private Sub CommandButton合并數(shù)據(jù)_Click()

'合并符號(hào)不能為空

With ThisWorkbook.Worksheets("操作界面")

Dim mergetext As String

If .Cells(4, "C").Value <> "" Then

mergetext = .Cells(4, "C").Value

Else

MsgBox "請輸入合并符號(hào)"

Exit Sub

End If

'合并區(qū)域不能為空

Dim mergerange As String

If .Cells(7, "C").Value <> "" Then

mergerange = .Cells(7, "C").Value

Else

MsgBox "請輸入合并區(qū)域地址"

Exit Sub

End If

'清除原結(jié)果區(qū)域

.Cells(10, "B").Value = ""

'合并數(shù)據(jù)

Dim itemcell

Dim mergeresult As String

For Each itemcell In ThisWorkbook.Worksheets("待合并數(shù)據(jù)").Range(mergerange)

If itemcell.Value <> "" Then

If mergeresult <> "" Then

mergeresult = mergeresult & mergetext & itemcell.Value

Else

mergeresult = itemcell.Value

End If

End If

Next

.Cells(10, "B").Value = mergeresult

End With

End Sub


【實(shí)例13-分割數(shù)據(jù)至多個(gè)單元格】【實(shí)例14-合并多個(gè)單元格數(shù)據(jù)】Excel表格VBA編程實(shí)例的評(píng)論 (共 條)

分享到微博請遵守國家法律
镇康县| 花垣县| 郴州市| 湖南省| 凤翔县| 平遥县| 新宾| 祁东县| 西充县| 高陵县| 教育| 昌平区| 陵川县| 乐安县| 宝鸡市| 武平县| 章丘市| 阜南县| 娄底市| 西峡县| 郎溪县| 措美县| 奉节县| 定陶县| 高邮市| 吉林省| 孟村| 琼海市| 吴桥县| 江口县| 周口市| 鄂托克前旗| 武山县| 丰顺县| 汶川县| 江山市| 富川| 赣榆县| 资阳市| 乾安县| 榆中县|