将数据从每 X 列移动到 Excel 中的单列中
使用修改答案解决问题
Dim i As Long, values As Range, current As Range
Set current = Range("D4") '//select 1st anchor cell
Do Until current.Value = ""
i = i + 45
Set values = Range(current.Offset(2, 0), current.Offset(45, 0)) '//select all in the ooc column
values.Copy '//got block of data here
Sheets("Sheet1").Range("A" & i).PasteSpecial
Set current = current.Offset(0, 13) '//next page
Loop
从 Excel 电子表格的 C 列开始,我有 13 列宽的数据页。我需要将第二列和第三列中的数据传输到 SQL 数据库,因此我尝试将每页上的这两列移至彼此之上进行传输。
下面的屏幕截图是我正在使用的数据。我需要捕获 ODC CSS 服务器 RowX CabX 下的服务器名称及其相应的资产标签。如果我可以每 13 行取出 2 列并将它们堆叠起来,我就可以自己删除额外的信息。
电子表格 http://img830.imageshack.us/img830/6126/unledoks.png
我确信我不需要提及这会节省大量的时间,但我确实需要一些帮助来开始使用或使用示例宏来完成此操作。不幸的是,我没有太多 VBA 经验,但我会尽我所能获得帮助。
Problem Solved using modifications to answer
Dim i As Long, values As Range, current As Range
Set current = Range("D4") '//select 1st anchor cell
Do Until current.Value = ""
i = i + 45
Set values = Range(current.Offset(2, 0), current.Offset(45, 0)) '//select all in the ooc column
values.Copy '//got block of data here
Sheets("Sheet1").Range("A" & i).PasteSpecial
Set current = current.Offset(0, 13) '//next page
Loop
Starting in column C of an excel spreadsheet, I have pages of data 13 columns wide. I need to transfer the data in the 2nd and 3rd columns to a SQL Database, so I'm trying to move those 2 columns on each page on top of eachother for transfer.
The Screenshot below is the data im working with. I need to capture server names under ODC CSS Servers RowX CabX along with its corresponding asset tag. If i can just take those 2 columns every 13 rows and stack them I can delete the extra information on my own.
Spreadsheet http://img830.imageshack.us/img830/6126/unledoks.png
I'm sure I don't need to mention the insane amount of time this would save but I could really use some help getting started with, or using an example macro to accomplish this. I don't have much for VBA experience unfortunately, but I will work with what help I can get.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样;
What about;