0
안녕하세요 여러분, 내 셀의 일부를 currentdate로 업데이트하려고하고 있으므로 다음을 수행했지만 셀을 업데이트 할 수 없습니다.각 루프 업데이트 셀의 경우
편집 : 전체 코드에서 누락 된 기능을 추가합니다.
Sub GetField32AFromCell()
For Each Cell In Worksheets("MM_Creation_Success").Range("G2:G9")
'Get cell which is right side of the current cell in for each loop
Dim nextRange As Variant: nextRange = Cell.Offset(0, 1).Value
'split the value of the cell into string array
Dim splitString() As String: splitString = SplitStringByNewLine(Cell)
For Each sString In splitString
Dim newLine As String: newLine = sString
newLine = TryGetField32A(newLine)
If Not newLine = "" Then
Dim newDateString As String: newDateString = GetCurrentDate("yymmdd")
Dim new32AField As String: new32AField = Mid(newLine, 7)
new32AField = newDateString + new32AField
'Set nextRange = new32AField
'MsgBox (nextRange)
End If
Next
Next
End Sub
Public Function SplitStringByNewLine(stringArray As Variant) As String()
SplitStringByNewLine = Split(stringArray, Chr(10))
End Function
Public Function TryGetField32A(newLine As String) As String
If newLine Like ("*:32A:*") Then
TryGetField32A = Mid(newLine, Len("*32A::"), Len(newLine))
'MsgBox ("Found Tag 32A: " + field32AVal)
End If
End Function
Public Function GetCurrentDate(dateFormat As String) As String
Dim todayDate As String: todayDate = Format(Date, dateFormat, vbMonday, vbUseSystem)
GetCurrentDate = todayDate
'MsgBox ("Current Date in Format (" + dateFormat + "): " + todayDate)
End Function
는 여기에'splitString = SplitStringByNewLine (셀)'오류를 얻고 있지? 배열에 할당하려고 시도했습니다 –
다른 기능을 붙여 넣는 것을 잊어 버려 죄송합니다. – user3167398