- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的代码中,它标识了 A 列“这是日期格式”和“这不是日期格式”中的每个值。但我需要它从 A:F 复制值在它声明“这不是日期格式”的行中,并将其粘贴到它上面的特定单元格中。偏移量(-1, 2)。还要在复制的值之后删除单元格“这不是日期格式”的行。任何想法谢谢。下面是我的代码:
Dim strDate As String
Dim rng As Range, cell As Range
Set rng = Range("A2:A18")
With ThisWorkbook.Worksheets("Feuil1")
For Each cell In rng
MsgBox (cell.Value)
strDate = cell.Value
If IsDate(strDate) Then
MsgBox "This is a date format"
Else
MsgBox "This is not a date format"
'copy cell from A:E
Range("A" & ActiveCell.Row & ":F" & ActiveCell.Row).Copy
'Paste selected and copied in specific cell in offset(Row, Column)
Range("K" & ActiveCell.Row).Offset(-1, 2).PasteSpecial
'copy cell from A:E
'Paste selected and copied in specific cell in offset(Row, Column)
End If
Next cell
End With
End Sub
最佳答案
请尝试下一个代码。它适用于所有 A:A 范围(带有数据)。如果您只需要 A18,请更改 lastRow = 18
:
Sub testCopyNotDate_DeleteRow()
Dim sh As Worksheet, strDate As String, rngDel As Range
Dim lastRow As Long, i As Long
Set sh = ThisWorkbook.Worksheets("Feuil1")
lastRow = sh.Range("A" & Rows.count).End(xlUp).Row
For i = 2 To lastRow
If Not IsDate(sh.Range("A" & i).Value) Then
sh.Range("A" & i & ":F" & i).Copy Destination:=sh.Range("A" & i).Offset(-1, 2)
If rngDel Is Nothing Then
Set rngDel = sh.Range("A" & i)
Else
Set rngDel = Union(rngDel, sh.Range("A" & i))
End If
End If
Next i
If Not rngDel Is Nothing Then rngDel.EntireRow.Delete xlUp
End Sub
一次删除行会非常快(对于大范围)......
关于excel - 从 A :F where it indicates "This is not a date format" and paste the values in a specific column 复制行值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63186173/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 11 个月前关闭。 Improve this
这个问题在这里已经有了答案: JavaScript get clipboard data on paste event (Cross browser) (23 个回答) 关闭 8 年前。 我有一个
我有一个 NSTextView,用户可以将纯文本粘贴到其中。 当用户在粘贴板中有“foo”时,我想粘贴“bar”。换句话说,用户转到网络浏览器,选择“foo”,cmd+c,切换到我的 NSTextVi
我对 do.call 如何工作感到困惑。 dat <- data.frame(v1 = c("a", "a", "b", "b"), v2 = c("a", "b"
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我刚刚熟悉 VBA 和我的代码 For k = 3 To ThisWorkbook.Sheets.Count ThisWorkbook.Sheets(k).Activate ActiveSheet.C
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 9年前关闭。 Improve this que
这个问题在这里已经有了答案: Intercept paste event in Javascript (4 个答案) 关闭 9 年前。 我需要更改粘贴事件的标准行为。我想将 Paste 事件的执行延
只执行一次粘贴我可以使用: noremap p p:let @"="" 粘贴后清空寄存器,后面的粘贴就失效了。然而,将发生的是更新撤消的空粘贴。因此按 p 3 次将需要 3 撤消调用以撤消初始粘贴。
在一个项目中,我发现一些 css 文件“闻起来”就像其中有复制粘贴的规则。 我想知道您检测文件中复制粘贴内容的策略是什么。 只是出于好奇,我想听听您显示文件相似性的提示和技巧! 最佳答案 试试 Sim
考虑以下示例: plot(c(2,4,6)~c(1,2,3),xlab="x", ylab=expression(paste('flux (g ',CO[2]~m^{-2}~h^{-1},')')))
对我来说是真正的问题,因为我不知道解决它。 我编写的 jQuery 脚本应该获取“粘贴”操作的输入值,并通过 ajax 将其传递给 codeigniter Controller 。 它实际上工作得很好
这是我正在尝试解决的问题 - 我完全不确定它是否可能。我有一个网络应用程序,我需要启用从应用程序到应用程序的数据复制/粘贴,但我遇到了粘贴问题。如果我使用 CTRL + V 快捷方式过去,我可以使用
这个问题已经有答案了: Printing newlines with print() in R (5 个回答) 已关闭 8 年前。 使用paste()函数时如何插入新行或者任何在 R 中连接字符串的函
我正在使用 sfsmisc 包中的 pretty10exp() 来使科学记数法看起来更好。例如: library(sfsmisc) a pretty10exp(a, digits.fuzz=3) #
我在下面的数据框中有两列,每一列都有按照特定顺序的级别: head(x1) soa congruency 1 200 9 2 102 2 3 68
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个 edittext 字段,当我想在上面粘贴某人时,“粘贴”弹出窗口的文本颜色(系统默认“粘贴”弹出窗口,不是自定义的)不是与应用程序的全局文本颜色相同,仍然是黑色,很难阅读: 这是我的整体主题
我想自定义 matplotlib 图像显示,以便我可以键入 control-c,它将图像复制到剪贴板,然后我可以将它复制到 openoffice 电子表格以组织我所有的原始数据和图像结果。有什么办法吗
我有一个函数可以计算一些东西,然后将其分配给一个矩阵。该矩阵的名称来自粘贴语句(基于其他一些当前值)。然后我想将 dimnames 分配给矩阵,但不知道如何理解粘贴的名称。 事情是这样的: funct
我是一名优秀的程序员,十分优秀!