macro: wanting final cell same as initial cell

lagrangePoint3

New Member
Joined
Jun 22, 2022
Messages
16
Office Version
  1. 365
Platform
  1. Windows
I made a macro to put a check mark into a cell.
Then I made it into a button and put it on the Quick Access Toolbar in the Personal Workbook.

When I run the macro, it puts a checkmark into the initial cell, but then moves the cursor into a different cell.
It always moves the cursor into the same different cell, though.
I would like it to stay on the cell it's putting the checkmark into.

While I was creating the macro, it grayed out the Stop Macro Recording button until I moved the focus out of the cell.
I didn't move to the cell it's ending on though, just moved into the next cell to it's right.

If I want to retain the same cell as the checkmark at the end of the macro, do I need to move it to a different cell as I did, and then move it back again?
I'll try that as I wait for your reply. Thanks.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I suggest that you post the existing code for the macro so that we can assess what it is doing. See my signature block below regarding how to post vba code.
 
Upvote 0
VBA Code:
Sub Checkmark()
'
' Checkmark Macro
' inserts a checkmark in Wingdings font, centered, into a cell.
'
' Keyboard Shortcut: Ctrl+h
'
    With Selection.Font
        .Name = "Wingdings"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    ActiveCell.FormulaR1C1 = "ü"
    Range("H1").Select
End Sub
 
Upvote 0
When I run the macro, it puts a checkmark into the initial cell, but then moves the cursor into a different cell.
It always moves the cursor into the same different cell, though.
I would like it to stay on the cell it's putting the checkmark into.
Then remove this line near the end of the macro.

Rich (BB code):
    End With
    ActiveCell.FormulaR1C1 = "ü"
    Range("H1").Select
End Sub
 
Upvote 0
Solution
You are welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,686
Messages
6,126,202
Members
449,298
Latest member
Jest

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top