1 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

How to run Macro on only selected cells?

I have macro that changes to size of comments. Can anyone help me to adjust it so it only runs on selected cells? Much appreciated!

Sub ResizeSelectedComments() Dim xComment As Comment ' Set desired dimensions Const xWidth = 713 Const xHeight = 355 For Each xComment In Application.ActiveSheet.Comments With xComment.Shape .Width = xWidth .Height = xHeight End With Next End Sub 
submitted by /u/Hot_Classroom_1785
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article