从下面的单元格中添加新的行,递增字母字符串中的最后一个数字

发布于 2025-01-25 00:22:06 字数 666 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尬尬 2025-02-01 00:22:06

经过多次试验,我的内部能够使其与此相处:

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")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文