打印内容变化的动态Excel页面 [英] Print dynamic Excel page with changing content

查看:61
本文介绍了打印内容变化的动态Excel页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有两个工作表的Excel工作簿.
第一个表格上,我有一个表格" ,在第二个表格上,所有数据.

I have an Excel workbook with two worksheets.
On the first one I have a "form" and on the second all the data in a table.

我所做的是,在第一张工作表上,我更改了一个 ID号,然后一个函数在第二张工作表中查找了ID号,然后更改了我已经存储的单元格上的数据指定给第二页上的内容.
它用于支付公司员工的费用,目前有 50个唯一ID .

What I have done is that on the first sheet I change an ID number, then a function looks at the second sheet to find the ID number and then changes the data on the cells I've specified to those on the second page.
It is for paying company employees and there are currently 50 unique ID's.

是否可以通过一种方法一次打印出具有不同内容的第一张纸?有人知道这样做的方法吗?

Is there a way to print the first sheet with different content in one click if possible? Does anyone know a way to do this?

推荐答案

您可以对工作表(2).range("A1:A50")...下一个myCell中的每个myCell使用类似的code>循环遍历具有不同ID的所有存储单元格,并将每个值放入工作表1上的单元格.
这就是我的意思

You can use something like this For each myCell in worksheets(2).range("A1:A50")...next myCell to loop through all the stored cells with different ID's and put each of the value to the cell on the sheet 1.
This is what I mean

Sub PrintAll_IDs()
    For Each myCell In Worksheets(2).Range("A1:A50") 'range with stored ID's
        Worksheets(1).Range("A1") = myCell.value ' "A1" is the cell with ID that you change manually now
        Worksheets(1).PrintOut ' I'm not sure how to print using VBA, just showing the workflow
    Next myCell
End Sub

这篇关于打印内容变化的动态Excel页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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