从下面的单元格中添加新的行,递增字母字符串中的最后一个数字
New in VBA,确实尝试了网络上可用的不同示例,但无法使其正常工作,因为我的字符串仅增加1&随后的执行,字符串保持不变。
要求: 在第47行上方添加一条线。 新的单元格A47可以在单元格A48中使用字母数字字符串上的最后一个数字上的最后数字
:我当前的代码:
Dim Ws As Worksheet
Dim Updt As String
Dim num As Integer
Dim DD As String
Dim TT As String
num = num + 1
Updt = "Update/Mise À Jour #" 'ALPHANUMERIC STRING TO INCREMENT
DD = Date
TT = Time
Set Ws = ThisWorkbook.Worksheets("CF")
With Ws
.Rows(47).Copy
.Rows(47).Insert Shift:=xlShiftDown
.Range("A47:E47").ClearContents
.Range("B47") = DD & " " & TT
.Cells(47, 1).Value = Updt & num
End With
Any help will be apreciated.
New in VBA, did tried different examples available on the web but can't make it work as my string only increment by 1 & subsequent executions, the string stay the same.
Requirement:
Adding a line above row 47.
New cell A47 to increment last digit on alphanumerical string available in cell A48
My current code:
Dim Ws As Worksheet
Dim Updt As String
Dim num As Integer
Dim DD As String
Dim TT As String
num = num + 1
Updt = "Update/Mise À Jour #" 'ALPHANUMERIC STRING TO INCREMENT
DD = Date
TT = Time
Set Ws = ThisWorkbook.Worksheets("CF")
With Ws
.Rows(47).Copy
.Rows(47).Insert Shift:=xlShiftDown
.Range("A47:E47").ClearContents
.Range("B47") = DD & " " & TT
.Cells(47, 1).Value = Updt & num
End With
Any help will be apreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过多次试验,我的内部能够使其与此相处:
num =正确(范围“ A48”),2)
。格式(int(num) + 1,“ 00”)
After many trials, within my With, was able to make it work with this:
num = Right(Range"A48"), 2)
.Range("A47") = "Update/Mise À Jour # " & Format(Int(num) + 1, "00")