我正在尝试执行以下操作:
我需要分隔一些字符串,它们具有以下形式:
node:info:sequence(id:ASDF,LMD)
node:info:sequence:id:QWES
这些是可能的单个字符串格式...
现在,当用逗号连接时,我必须将它们分开...这样
node:info:sequence(id:ASDF,LMD),node:info:sequence:id:QWES
所以我尝试了
entries.split(",node");
哪个...有点用,但是我当然从前一个字符串中删除了“节点”部分,无论如何我都能检测到,
后跟node
,但用逗号{仅{1}}?
答案 0 :(得分:1)
您可以使用
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aFlag As Boolean: aFlag = False
Dim aCharName As String: aCharName = Sheets("Sheet1").Range("A1").Value
Dim i As Long
Dim ws As Worksheet
'On Error Resume Next
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets 'The For Loop: I think this is where the problem is
If ws.ChartObjects.Count > 0 Then 'check if there are any charts in worksheet
For i = 1 To ws.ChartObjects.Count 'loop through charts
If ws.ChartObjects.Name = aCharName Then
ws.ChartObjects(aCharName).ChartArea.Copy 'from now on the simple copy/paste
LastRow = Sheets("Sheet1").Cells(Sheets("Sheet1").Rows.Count, "A").End(xlUp).Row ' get the last row
Sheets("Sheet1").Select
Sheets("Sheet1").Range("A" & LastRow).Select
ActiveSheet.Pictures.Paste 'paste in the new last row
'probably best to use Offset to paste for the next iteration of the For Loop
End If
Next i
End If
Next
Application.ScreenUpdating = True
End Sub
请参见regex demo
积极的前瞻s.split(",(?=node\\b)")
将确保仅匹配那些逗号并紧跟整个单词(?=node\b)
(因为node
是单词边界)。