将数据从多个单元格复制到不同的工作表行 [英] Coping Data from multible cells to a different sheet row

查看:136
本文介绍了将数据从多个单元格复制到不同的工作表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在excel中做了一个报告我想要复制一堆彼此不相邻的单元格,即b8 b9 b10 h8 h9 h10 b14 b15 b16等我想将这些单元格复制到另一个工作表中插入一行并放入它们是excel数据库的一部分我是所有这些的新手,所以任何帮助都非常感谢。

I have a report done in excel i want to copy a bunch of cells not next to each other ie b8 b9 b10 h8 h9  h10 b14 b15 b16 etc i want to copy these cells an more to another worksheet  insert a row and put them in a row kinda of a excel data base I am new to all this so any help is very thankful.

推荐答案

使用数字作为数据输入列号而不是字母。

子运行()
Dim Rows(9),Column(9),n,numbercopied As Variant
Column(1)= 2
行(1)= 8
列(2)= 2
行(2)= 9
列(3)= 2
行(3)= 10
列(4)= 8
行(4)= 8
列(5)= 8
行(5)= 9
列(6)= 8
行(6)= 10
列(7)= 2
行(7)= 14
列(8)= 2
行(8)= 15
列(9)= 2
行(9)= 16
数字复制= 9
n = 1
对于k = 1到数字复制的表格("Sheet2")。单元格(n,1)=表格( "Sheet1")。单元格(行(k),列(k))
n = n + 1
下一个k
结束子

我把它放进去进入"sheet2"在A列或1列中。您可以将它们放在任何您喜欢的地方。

Enter you data using a number as the column number instead of a letter.

Sub run()
      Dim Rows(9), Column(9), n, numbercopied As Variant
           Column(1) = 2
           Rows(1) = 8
           Column(2) = 2
           Rows(2) = 9
           Column(3) = 2
           Rows(3) = 10
           Column(4) = 8
           Rows(4) = 8
           Column(5) = 8
           Rows(5) = 9
           Column(6) = 8
           Rows(6) = 10
           Column(7) = 2
           Rows(7) = 14
           Column(8) = 2
           Rows(8) = 15
           Column(9) = 2
           Rows(9) = 16
           numbercopied = 9
           n = 1
      For k = 1 To numbercopied
           Sheets("Sheet2").Cells(n, 1) = Sheets("Sheet1").Cells(Rows(k), Column(k))
            n = n + 1
      Next k
End Sub

I put it into "sheet2" in column A or 1.  You can put them anywhere you like.


这篇关于将数据从多个单元格复制到不同的工作表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆