跳到主要内容

如何在Excel中创建动态打印区域?

通常,在设置工作表后,打印区域是恒定的。 在某些情况下,您希望打印区域随时随您删除或添加的打印内容进行调整。 如何实现呢? 在本文中,我们将向您展示在Excel中创建动态打印区域的方法。

在Excel中创建动态打印区域


箭头蓝色右气泡 在Excel中创建动态打印区域

如下面的屏幕截图所示,假设您的正常打印区域是A1:E5,但是范围数据可能会一直增长到第10行和G列。您可以按照以下步骤创建动态打印区域。

1.首先需要创建一个动态的命名范围。 请点击 公式 > 名称管理员。 看截图:

2.在 名称管理员 对话框中,单击 全新 按钮打开 新名字 对话框。 在“新名称”对话框中,输入 打印面积公式名字 框,然后输入公式 =OFFSET($A$1,0,0,COUNTA($A$1:$A$10),COUNTA($A$1:$G$1)) 框,最后单击 OK 按钮。 看截图:

备注: 在公式, 10澳元$ G $ 1 表示打印区域不会超过第10行和G列。您可以根据需要进行更改。

3.返回到 名称管理员 对话框,请关闭它。

4.选择要设置为打印区域的数据范围(在这种情况下,我们选择 A1:E5),然后点击 页面布局 > 打印区 > 设置打印区域。 看截图:

5。 点击 公式 > 名称管理员 打开 名称管理员 对话框。

6.在 名称管理员 对话框中,选择 打印区域 ,在 名字 框,然后将原始公式替换为 = 打印区域公式 (您在上面创建的动态范围的名称) 框,然后单击 按钮保存更改。 最后关闭 名称管理员 对话框。

现在创建了动态打印区域。 您可以看到打印区域正在根据您添加或删除的数据进行调整,直到到达指定的行和列为止。 看截图:

最佳办公生产力工具

热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

kte选项卡201905


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (10)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Plain and simple, I've tried it a dozen times, made adjustments and still doesn't work. It won't take the formula. It keeps reverting, which means its reading the formula as an error. Don't get it. The name of my sheet is Contract Invoice. I don't see where you put that in the formula. I've tried replacine the COUNTA with the name of the sheet, tried putting it before and after COUNTA, but still nothing. My email is obviously listed above. If anyone has any suggestions, I'll try them.
This comment was minimized by the moderator on the site
Hi John,
If you wanted a print area for all non-blank rows, you might have something like
=OFFSET('Contract Invoice'!$A$1:$S$1,0,0,MAX(IF('Contract Invoice'!$A$1:$A$1005<>"",ROW('Contract Invoice'!$A$1:$A$1005),0)))

or whatever you like. The sheet name in the formula shouldn't matter.

You'd then define this name (say =my_print_area) as above mentioned above and set the "scope" to the workbook.

Then define your Print_Area to link to this formula and set the Scope to "Contract Invoice".

Hope that helps.
This comment was minimized by the moderator on the site
This was the best solution to this problem I found, after hours of searching
Rated 5 out of 5
This comment was minimized by the moderator on the site
this is definitely super usefull. However, each time I close and reopen the file, the Print_Area name configuration is gone. So each time I have to go to Define Names, and say Print_Area = Print_Area_Formula. Someone else with the same issue?? Thx!
This comment was minimized by the moderator on the site
Yeah, this is the only problem, but it only seems to happen when you open the Page Layout settings. Otherwise, it seems to be fine.
This comment was minimized by the moderator on the site
Ca ne fonctionne pas. A chaque fois qu'on faire le gestionnaire de noms et qu'on rentre dedans, il a remplacé la formule par la zone area de départ
This comment was minimized by the moderator on the site
Hi, just one thing, is your formula dynamic?. Would this be better =OFFSET($A$1,0,0,COUNTA($A:$A),COUNTA($1:$1))?

Then when the pivot changes or cells or columns are added the formula does not need to change.
This comment was minimized by the moderator on the site
First of all, thanks a lot!


Secondly: you don't need to define two "names" in the Mame Manager. As a simpler alternative, just select some random cells and set the print area (on those random cells), then open the Name Manager: it will have the print_area already in: here you can replace the content with the formula you want.
This comment was minimized by the moderator on the site
hi
thank you, it is great.

is there any way to have a conditional reference for the offset? I mean use the offset from the first cell in column A that contains a letter A, or equal to number 3 or filled by the color yellow.

I tried the following formula but it doesn't work.

offset(indirect(CELL("address",INDEX(A:A,MATCH("A",A:A,0)))),0,1,COUNTA(Sheet1!$b+Sheet1!$b:$b),7)

thanks

Mike
This comment was minimized by the moderator on the site
Hello,Its useful &exciting.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations