- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 AutoFilter
对 VBA 中的表格进行排序,这会产生较小的数据表。我只想在应用过滤器后复制/粘贴一列的可见单元格。另外,我想对一列的过滤值进行平均,并将结果放入不同的单元格中。
我在堆栈上找到了这个片段,它允许我复制/粘贴过滤器的整个可见结果,但我不知道如何修改它或另一种方法来仅获取一列的数据(没有标题)。
Range("A1",Cells(65536,Cells(1,256).End(xlToLeft).Column).End(xlUp)).SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet2").Range("A1").PasteSpecial xlPasteValuesAndNumberFormats
Application.CutCopyMode = False
添加答案(使用过滤后的值进行计算):
tgt.Range("B2").Value =WorksheetFunction.Average(copyRange.SpecialCells(xlCellTypeVisible))
最佳答案
我在 Sheet1 上设置了一个简单的 3 列范围,其中 A、B 和 C 列中包含国家/地区、城市和语言。以下代码自动筛选该范围,然后仅将自动筛选数据的其中一列粘贴到另一张工作表。您应该能够根据您的目的修改它:
Sub CopyPartOfFilteredRange()
Dim src As Worksheet
Dim tgt As Worksheet
Dim filterRange As Range
Dim copyRange As Range
Dim lastRow As Long
Set src = ThisWorkbook.Sheets("Sheet1")
Set tgt = ThisWorkbook.Sheets("Sheet2")
' turn off any autofilters that are already set
src.AutoFilterMode = False
' find the last row with data in column A
lastRow = src.Range("A" & src.Rows.Count).End(xlUp).Row
' the range that we are auto-filtering (all columns)
Set filterRange = src.Range("A1:C" & lastRow)
' the range we want to copy (only columns we want to copy)
' in this case we are copying country from column A
' we set the range to start in row 2 to prevent copying the header
Set copyRange = src.Range("A2:A" & lastRow)
' filter range based on column B
filterRange.AutoFilter field:=2, Criteria1:="Rio de Janeiro"
' copy the visible cells to our target range
' note that you can easily find the last populated row on this sheet
' if you don't want to over-write your previous results
copyRange.SpecialCells(xlCellTypeVisible).Copy tgt.Range("A1")
End Sub
请注意,通过使用上述语法进行复制和粘贴,不会选择或激活任何内容(在 Excel VBA 中应始终避免这样做),并且不会使用剪贴板。因此,Application.CutCopyMode = False
不是必需的。
关于excel - 从过滤表的一列复制/粘贴/计算可见单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17531128/
我正在遵循一个教程,老师通过以下方式将 html 粘贴到我们的 scrappy shell 中:%paste (下面的 html) html_doc = " " Title of hte page
例如 1.1.1.1 a.com 2.1.1.1 b.com 1.3.1.1 c.com 1.1.5.1 d.com 1.2.1.1 e.com 现在我想从另一个文本中替换这个 ip,不一样
是否有机会在 Angular 中实现粘贴按钮。 FE:用户复制网站的链接,当他或她点击按钮时,在我的页面上复制的链接应该出现在文本框中。 谢谢! 最佳答案 您只能以编程方式从网页复制。您不能以编程方式
我正在尝试提高 Vim 中粘贴功能的可用性,因为太多不同的删除操作(实际上我认为它们都是这样)也会拉到粘贴缓冲区。 这意味着我不再能够删除一些我想粘贴到某处的文本,清理一些东西,以及。然后 做我的粘贴
我正在构建一个简单的 Electron 应用程序,以在屏幕上的其他所有内容上显示一些文本。 有一个键盘快捷键可以打开带有文本的弹出窗口。 我想添加一个小功能。 最好的情况是:在计算机上的任意位置选择一
我有一个双击事件,我希望它保存特定范围的副本。 Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boo
我已经为这个烦人的问题苦苦挣扎了一段时间,但没有找到一个优雅的解决方案。 假设我有这样一个类层次结构: class StatWithBounds[A](val min: A, val max: A,
现在我有一个 Word 宏,可以通过将图像复制并粘贴到该位置来将图像移动到特定文本前面。这种方法效果很好,但成本很高。如果我的 Word 文档中有 1,000 张图像,则运行宏可能需要 30 分钟。
让我以我是自学成才的事实作为我的问题的开头,所以请提供尽可能详细的信息,如果我需要您以不同的方式或多次解释,请耐心等待。 我使用 Microsoft Visual Basic 7.0 为我的团队创建了
我已经为这个烦人的问题苦苦挣扎了一段时间,但没有找到一个优雅的解决方案。 假设我有这样一个类层次结构: class StatWithBounds[A](val min: A, val max: A,
我正在使用 Meteor 开发一个聊天应用程序,我不希望用户能够出于明显的垃圾邮件原因将内容复制/粘贴到表单中。这可能吗?这是我用来运行聊天应用程序的代码: Javascript: // render
我已经为此搜索了很多,但找不到任何建议...我提供了我自己的经典操作栏实现,所以我在所有 Activity 中声明粘贴/等..有谁知道如何做到这一点? 此外,我将提供我自己的复制/粘贴功能,并且仅在需
Windows 中 SWT Text 的默认上下文菜单有几个我们不想要的选项。由于操作系统提供的默认上下文菜单无法修改,因此我创建了一个自定义上下文菜单,其中只有基本的文本操作,例如文本框的删除、剪切
我最后的问题不是很清楚,我再试一次。 在我的 Tumblr 博客 (http://anti-standard.tumblr.com) 上,您可以看到一张图片(图片上写着“ANTI STANDARD”)
我必须编写一个脚本文件来剪切以下列并将其粘贴到新 .arff 文件中同一行的末尾。我想文件类型无关紧要。 当前文件: 63,male,typ_angina,145,233,t,left_vent_hy
是否可以发送过去的命令,以便将文本粘贴到当前聚焦的编辑文本中。场景: 后台服务监听通知(完成) 收到通知后,需要将文本复制到剪贴板(完成) 将文本粘贴到任何当前聚焦的字段,如果不可能则放弃粘贴命令。
我想用 PIL 粘贴一堆图片。出于某种原因,当我运行 blank.paste(img,(i*128,j*128)) 行时,出现以下错误:ValueError: cannot determine reg
如何在我的网页中禁用复制粘贴功能。准确地说,我不希望我的用户从我的网站上复制任何信息并将其用于个人目的。上一个关于同一主题的问题没有给出足够的解释。 onselect 和 ondrag 不起作用。请帮
废话不多说,直接上代码,小伙伴们仔细看下注释吧。 复制代码代码如下: /*简单的 复制 剪切 粘贴 功能 操作:
我应该在 vimrc 中添加哪一行以便在终端之间或不同文件/选项卡之间轻松复制/粘贴? 我现在有: " Better copy & paste set pastetoggle= set clipboa
我是一名优秀的程序员,十分优秀!