Dim counter As Integer
Sub InsertIncrementedLabel()
counter = counter + 1
Dim ws As Worksheet
Set ws = ActiveSheet
Dim xCoord As Double
Dim yCoord As Double
' Get the coordinates of the active cell
xCoord = ActiveCell.Left
yCoord = ActiveCell.Top
Dim shp As Shape
Set shp = ws.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=xCoord, Top:=yCoord, Width:=100, Height:=30)
shp.TextFrame.Characters.Text = "Label " & counter
shp.TextFrame.Characters.Font.Size = 16
shp.TextFrame.Characters.Font.Bold = True
End Sub
Sub AssignShortcutKey()
Application.OnKey "^+B", "InsertIncrementedLabel" ' Ctrl + Shift + B
End Sub
viernes, 25 de agosto de 2023
Excel - Label insert When Ctrl+Shift+B
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario