我希望有人可以帮助解决这段代码.如果我在A栏中找到文本'FemImplant',我想删除整行.棘手的部分是这个文本是由'$'链接的句子的一部分.所以我需要代码在'$'之前解析单元格内容,看看它是否与'FemImplant'匹配并删除该行.这是我到目前为止所做的,但它是无法工作的.
Dim cell As Excel.Range
RowCount = DataSheet.UsedRange.Rows.Count
Set col = DataSheet.Range("A1:A" & RowCount)
Dim SheetName As String
Dim ParsedCell() As String
For Each cell In col
ParsedCell = cell.Value.Split("$")
SheetName = ParsedCell(0)
If SheetName = "FemImplant" Then
cell.EntireRow.Delete Shift:=xlUp
End If
Run Code Online (Sandbox Code Playgroud)
下一个
我正在开发一个小项目,如果我在行中检测到"true",则需要我复制并粘贴某些列.我试图将这些选定的列粘贴到不同的工作表上,我想只粘贴它们的值而不是公式.
这是我到目前为止,我得到了粘贴特殊功能的错误.请帮忙.
' CopyIfTrue()
Dim Col As Range, Cell As Excel.Range, RowCount As Integer
Dim nysheet As Worksheet
Set nysheet = Sheets.Add()
nysheet.Name = "T1"
Sheets("FemImplant").Select
RowCount = ActiveSheet.UsedRange.Rows.Count
Set Col = Range("I2:I" & RowCount) 'Substitute with the range which includes your True/False values
Dim i As Integer
i = 1
For Each Cell In Col
If Cell.Value = "True" Then
Cell.Copy
Sheets("T1").Select 'Substitute with your sheet
Range("b" & i).Select
ActiveSheet.Paste
'Get sibling cell
Sheets("FemImplant").Select
Dim thisRow As Integer
thisRow …Run Code Online (Sandbox Code Playgroud) 有人可以帮助我将一列定义的单元格范围向右移动.如果我定义
rng = B2:B3
Run Code Online (Sandbox Code Playgroud)
我需要一个代码来将我的值移到B2:B3到B3:B4.
这是我到目前为止所做的一切,但这都不起作用.我在第三行收到错误.
Dim rng As Range
Set rng = Range(DataSheet.Cells(arr(z)(1), 2), DataSheet.Cells(arr(z)(1), LastCol))
rng.Insert Shift:=xlShiftToRight '(i tried this first)
or
rng.Offset(0, 1).Select '(I tried this second and this also did not work)
Run Code Online (Sandbox Code Playgroud)