我想在一个vba中收集所有床单 [英] I want to collect all sheets in one vba

查看:52
本文介绍了我想在一个vba中收集所有床单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码来清除一张纸上的内容,但我想扩展该区域以从另一张纸中添加另一个定义的名称

i have the following code to clear contents from one sheet but I want to expand the area to add another defined names from another sheets

Hany Samoil

Hany Samoil

推荐答案

您好
Hany Samoil,

如果我们看到您的代码,那么我们可以理解它只是首先取消保护工作表,然后清除一些范围,然后再次保护工作表。

if we see your code then we can understand that it is just unprotecting the sheet first, then clear some ranges and then again protect the sheets.

从主题的标题中,我们可以看到你要合并所有工作表的内容到一页。

from the title of the thread , we can see that you want to merge the contents of all the sheets in to one sheet.

请参考下面的代码。

Sub Combine()
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub

参考:

如何将工作表/工作簿合并到一个工作表中?

问候

Deepak


这篇关于我想在一个vba中收集所有床单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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