select all cells with comments in a specified range - two examples

  • Thread starter Thread starter DataFreakFromUtah
  • Start date Start date
D

DataFreakFromUtah

No question here, just some procedure examples for the archive.

Search criteria: select only cells in specified range select only
cells
with comments select cells with comments in specific range
select all comments in specific range select all comments select all
cell comments select comments in subrange comments subset select cells
containing
comments select all cells that contain comments


SELECT CELLS WITH COMMENTS ONLY IN SPECIFIED, TARGETED RANGE


Sub CommentsSelectInSpecificRangeExample1()
'Selects cells with comments in a range already
'named on the activeworksheet. Edit name of target
'range below

Dim TargetRange As Range

On Error Resume Next
Application.Goto Reference:="DATA" 'named range here
Set TargetRange = Selection
TargetRange.SpecialCells(xlCellTypeComments).Select

End Sub


Sub CommentsSelectInSpecificRangeExample2()
'Selects cells with comments in a range prompted for
'and selected by user

Dim TargetRange As Range

On Error Resume Next

Set TargetRange = Application.InputBox( _
prompt:="Select Range of
Cells to Select Any Comments Present in the Range", Type:=8)
TargetRange.SpecialCells(xlCellTypeComments).Select

End Sub
 
Hi DFFU,

It would probably be advisable to add Error trapping as the SpecialCells
method will complain if no comments exist in the selected range.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top