EXCEL VBA复制粘贴循环宏 [英] EXCEL VBA copy paste loop macro

查看:492
本文介绍了EXCEL VBA复制粘贴循环宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我每次单击按钮时都需要一个简单的宏来复制范围(I:M)和粘贴偏移量(0,5)。

最多492次


提前感谢您的帮助

解决方案

当你说出来时可能需要重复我发现自己很困惑。

  1. 以何种方式重复操作有意义?
  2. 指定的限制是否指代可以调用代码的次数通过一些触发器或是否需要一些循环?

    如果后者然后是什么决定了循环?
  3. Offset()你在谈论引用提到的 Range()对象,或者这是来自 Selection (你应该欣赏作为一种方法, Object()除非合格,否则没有任何意义。)

在发布之前请尽量考虑你的问题。


我需要复制产品表x492次。

每次点击按钮时添加下一个表并添加名称Z1,Z2,Z3等。


在我的宏Excel中,添加所有x492复制的范围。我想依赖ADD PRODUCT按钮来支持宏的功能。

或Combobox列表

如果sb从列表中选择Z1,那么将看到表格来放置数据

如果选择Z2,则会看到下一个表格,用于输入产品Z2等的数据。


循环确定单击添加产品按钮。


我改变了宏,现在看起来像下面:


如果我点击添加产品按钮,它会添加一次产品。

但我想将宏的功能与按钮联系起来。

每当我点击按钮时它会复制并粘贴范围偏移(0,5)

并添加Z2,Z3,Z4 ...单元格Q1(Z1),V1(Z2)等中的名称。


这是代码:

展开|选择|换行|行号

展开 | 选择 | Wrap | 行号

Hello,

I need a simple macro to copy range ("I:M") and paste offset(0,5) every time when I click the button.
max 492 times

Thanks in advance for any help

解决方案

When you say it might need to be repeated I find myself confused.

  1. In what way would repeating the action make any sense?
  2. Does the limit specified refer to the number of times the code can be invoked by some trigger or is there some looping required?
    If the latter then what determines the looping?
  3. Does the Offset() you''re talking about reference the Range() object mentioned or would this be from Selection (You should appreciate that as a Method, Object() has no meaning unless qualified.)?

Do please try to consider your question fully before posting it.


I need to copy Product Table x492 times.
Every time when clicking the button add next table and add name Z1, Z2,Z3 etc.

In my macro Excel add the copied range once all x492. I want to depend functioning of the macro from the button ADD PRODUCT.
or Combobox list
If sb choose Z1 from the list then will see the table to put the data
If choose Z2 will see the next table to input data for product Z2 etc.

The loop determines clicking on the button Add Product.


I change the macro and now it looks like underneath:

If I click the button ADD PRODUCT it add products one time.
But I want to relate the functioning of the macro to the button.
Everytime when I click the button it will copy and paste range offset(0,5)
and add Z2,Z3,Z4... name in cell Q1(Z1), V1(Z2) etc.

Here is the code:
Expand|Select|Wrap|Line Numbers

Expand|Select|Wrap|Line Numbers


这篇关于EXCEL VBA复制粘贴循环宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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