Results 1 to 4 of 4

Detecting a Comment in a cell

Threaded View

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Detecting a Comment in a cell

    I thougth I had this figured out.
    
    Option Explicit
    
    Sub MissingDims()
    'Original code by Leith Ross 11.02.08
    'Modified by Rick Stanich 09.03.09
    'Reviews Column "E" for blank cells (unreported values), Gets values from adjacent cells _
      and pastes to sheet4 Column J.
    
        Dim Blanks As Range
        Dim LastE As Range
        Dim LastRow As Long
        Dim rCell As Range
        Dim s As String
    
        Sheets("Sheet3").Activate
        With Sheets("Sheet3")
            Set LastE = Cells(Rows.Count, "E").End(xlUp)
        End With
        If Not IsEmpty(LastE) Then
            LastRow = WorksheetFunction.Max(LastE.Row)
            Set Blanks = Range("E6", Cells(LastRow, "E")).SpecialCells(xlCellTypeBlanks)
            'MsgBox LastRow 'for testing
    
            'Clear Cloum J on Sheet4, add header and format
            Sheets("Sheet4").Range("J:J").Clear
            Sheets("Sheet4").Range("J1").Value = "Missing Dims"
            Sheets("Sheet4").Range("J:J").NumberFormat = "@"
    
            For Each rCell In Blanks
                Sheets("Sheet3").Activate
                With rCell
                    'If rCell.Comment = "" Then    'New 12.16.10
                        'Create string
                        s = .Cells.Row & "     $$ #" & .Cells(1, -3) & ", " & _
                            .Cells(1, -2) & ", " & .Cells(1, 0)
                    'End If    'New 12.16.10
                End With
                'paste data
                Sheets("Sheet4").Activate
                With Sheets("Sheet4")
                    .Cells(Rows.Count, "J") _
                            .End(xlUp).Offset(1).Resize(rCell.Rows.Count).Value = s
                End With
            Next rCell
        End If
    End Sub
    I tried "If rCell.Comment = "" Then" but it is not acceptable and errors.
    Run-time error '438':
    Object doesnt support this property or method
    If a cell has a comment I want to skip it and move on to the next cell.

    Any tips hints or examples are appreciated.
    Last edited by Rick_Stanich; 12-16-2010 at 06:46 PM.
    Regards

    Rick
    Win10, Office 365

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1