本帖最后由 soykoa 于 2022-7-17 20:34 编辑
- Public Sub 自由流通盘()
-
- j = 2
- Do While Cells(j, 1) <> ""
-
- txtContent = Cells(j, 1)
- If Mid(Cells(j, 1), 1, 1) = "6" Then
- Cells(j, 10) = "SH" & Mid(txtContent, 1, 6)
- Cells(j, 11) = Cells(j, 2)
-
- Else
- Cells(j, 10) = "SZ" & Mid(txtContent, 1, 6)
- Cells(j, 11) = Cells(j, 2)
-
- End If
-
-
- j = j + 1
- Loop
-
- End Sub
-
- Public Sub 细分行业()
-
- j = 2
- Do While Cells(j, 4) <> ""
-
- txtContent = Cells(j, 4)
- If Mid(Cells(j, 4), 1, 1) = "6" Then
- Cells(j, 12) = "SH" & Mid(txtContent, 1, 6)
- Cells(j, 13) = Cells(j, 5)
-
- Else
- Cells(j, 12) = "SZ" & Mid(txtContent, 1, 6)
- Cells(j, 13) = Cells(j, 5)
-
- End If
-
-
- j = j + 1
- Loop
-
- End Sub
-
- Public Sub 主题概念()
-
- j = 2
- Do While Cells(j, 7) <> ""
-
- txtContent = Cells(j, 7)
- If Mid(Cells(j, 7), 1, 1) = "6" Then
- Cells(j, 14) = "SH" & Mid(txtContent, 1, 6)
- Cells(j, 15) = Cells(j, 8)
-
- Else
- Cells(j, 14) = "SZ" & Mid(txtContent, 1, 6)
- Cells(j, 15) = Cells(j, 8)
-
- End If
-
-
- j = j + 1
- Loop
-
- End Sub
复制代码 这三段是我在网上找的一截代码自己改出来的三段,,,,怎么把这三段合并成一个代码,,,,只需要点一次,,,就分别去生成相应列的数据呢? |