You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用Excel VBA一次性在游戏卡片上打印5个选中数字的Chr 149符号

解决方案:批量标记游戏卡片选中数字并打印

要一次性给5个选中数字加上Chr(149)(圆点符号)再打印,你需要先给目标单元格批量添加标记,再执行打印操作。以下是修改后的完整代码:

Sub PrintMarkedNumbers()
    Dim targetRng As Range
    Dim cell As Range
    
    ' 1. 定义需要标记的5个选中数字所在单元格
    ' 请根据实际位置修改这个范围,比如Range("B2,D4,F6,H8,J10")或者命名区域
    Set targetRng = ActiveSheet.Range("A1,C3,E5,G7,I9")
    
    ' 2. 批量给每个单元格添加Chr(149)标记
    For Each cell In targetRng
        ' 在数字前添加圆点,也可以改成cell.Value = cell.Value & " " & Chr(149)放在后面
        cell.Value = Chr(149) & " " & cell.Value
    Next cell
    
    ' 3. 保留你原有的打印设置
    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(1.13)
        .RightMargin = Application.InchesToPoints(0.707)
        .TopMargin = Application.InchesToPoints(1.528)
        .BottomMargin = Application.InchesToPoints(0.748031496062992)
        .HeaderMargin = Application.InchesToPoints(0.31496062992126)
        .FooterMargin = Application.InchesToPoints(0.31496062992126)
    End With
    
    ' 4. 执行打印
    ActiveSheet.PrintOut
    
    ' 可选:打印完成后清除标记,恢复原数字(如果不需要保留标记的话)
    For Each cell In targetRng
        ' 去掉前面的圆点和空格,如果你是加在后面就改成Right(cell.Value, Len(cell.Value)-2)
        cell.Value = Right(cell.Value, Len(cell.Value) - 2)
    Next cell
End Sub

关键说明:

  • 修改目标范围:一定要把targetRng改成你实际存放5个选中数字的单元格地址,比如游戏卡片上的对应位置。
  • 标记位置调整:如果想把圆点放在数字后面,把添加标记的那行代码改成cell.Value = cell.Value & " " & Chr(149),同时清除标记的代码也要对应调整。
  • 保留标记选项:如果打印后需要保留圆点标记,把最后那段清除标记的循环删掉就行。

内容的提问来源于stack exchange,提问作者Pasquale Prudente

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 19:32:36