excel - VBA 将数据分离和转置成行
问题描述
我一直在试图弄清楚如何使用以下格式将工作表上的两列数据分成行。
从:
至:
我能够从另一个帖子(下面链接)中找出其中的一部分(分离和转置 B 列中的名称),但我不知道如何复制 A 列中的数据
Sub Vertical()
Dim i As Long, st As String
i = 1
Dim startP As Range
For Each r In Selection
If i = 1 Then
st = r.Text
i = 2
Else
st = st & "," & r.Text
End If
Next r
Set startP = Selection(1, 2)
ary = Split(st, ",")
i = 1
For Each a In ary
startP(i, 1).Value = a
i = i + 1
Next a
End Sub
当然,实际数据是我们系统中的一长串工作区和工作它们的员工。我只是不能在这里发布。
先感谢您!!!
解决方案
推荐阅读
- selenium - Jenkins 无法为特定构建编译所有 JSON 报告(net.masterthought.cucumber.ValidationException:传递的文件没有功能!)?
- android - 为什么我的应用程序在使用 onclicklistener 时崩溃?
- php - 图表: php in html in php 不起作用,如何解决?
- xml - 使用 XSD 过滤 anyURI 类型的 XML 元素
- c# - 从控制台应用程序 c# 运行 selenium 测试用例
- c++ - 为什么部分初始化一个类然后调用委托 ctor 会失败?
- java - Spring Boot 和 Jackson:定义要在外部类上序列化的字段
- prism - 更改 Prism Dialogwindow 的 windowStyle
- python - AttributeError: 'float' 对象没有属性 'append'
- c# - 自定义模型绑定器触发并运行,但永远不会绑定属性值