按钮命令 - 复制并粘贴{Excel} [英] Button Command - Copy and Paste {Excel}

查看:171
本文介绍了按钮命令 - 复制并粘贴{Excel}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sheet1中有一个表格 - 列a,b,c,d和第2行到第100行有不同的数据。

i想要在sheet2中放入一个命令按钮来复制来自sheet1的行(a2在单元格(e1,e2,f3)的sheet2中,b2,d2)。当我再次按下按钮命令时,从sheet2的相同单元格中复制sheet1(a3,b3,d3)中的下一行,当我按下命令按钮时这么长。

p.s->帮助和坦克!

展开 | 选择 | Wrap | 行号

解决方案

这应该指向正确的方向:

展开 | 选择 | Wrap | 行号


你好,ADezii!我感谢您的回复;),但我有一个问题!当我按下命令按钮时,我想从sheet2中的sheet1(例如:第2行)复制一行(例如在第2行中)。当我再次按下命令按钮时,我想在sheet2(第2行)的同一位置复制sheet1的下一行(例如:第3行)!我再次按下命令按钮,我想从sheet1(第2行)中的同一位置复制sheet1的下一行(例如:第4行)。

抱歉,我不太懂英文!


我的帖子只是指向正确的方向。你需要做的是:

  1. 创建一个全局变量或静态变量来保留当前行号。
  2. 点击()工作表2上的命令按钮的事件,增加表示行号的变量的值,然后从Sheet1复制数据(一次1行),保持行相同,但将列偏移4。
  3. 提供重置变量的机制。
  4. 如果您仍有问题,请告诉我,我会发布一些更明确的内容。


i have a tabel in sheet1 - columns a,b,c,d and rows 2 to 100 with different data.
i want to put in sheet2 a command button to copy row from sheet1( a2,b2,d2) in sheet2 in the cells ( e1,e2,f3). when i press the button command again copy next row from sheet1(a3,b3,d3) in same cells from sheet2, and so long when i press the command button.
p.s-> help and tanks!

Expand|Select|Wrap|Line Numbers

解决方案

This should point you in the right direction:

Expand|Select|Wrap|Line Numbers


hello, ADezii! i thank you for your response ;), but i have a problem! when i push the command button I would like to copies one row from sheet1(the example: row 2) in sheet2(for example in row 2). when i push the command button again, i want to copies next row from sheet1(the example: row 3) in same place in sheet2 ( row 2 )! i press command button again, i want to copies next row from sheet1( the example: row 4) in same place in sheet2(row 2).
Sorry I don''t know so good english!


My Post was to only point you in the right direction. What you need to do is to:

  1. Create a Global or Static Variable to keep tract of the Current Row Number.
  2. In the Click() Event of the Command Button on Sheet 2, increment the Value of the Variable representing the Row Number, then copying the data (1 Row at a time) over from Sheet1 keeping the Rows the same but offsetting the Column by 4.
  3. Provide a mechanism to RESET the Variable.
  4. If you are still having problems, let me know, and I''ll post something a little more definitive.


这篇关于按钮命令 - 复制并粘贴{Excel}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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