Results 1 to 22 of 22

Belonging Row is not clear in Code

Threaded View

  1. #1
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Belonging Row is not clear in Code

    Hi @ all,

    I have the following Code

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("K:K")) Is _
        Nothing Then Exit Sub
    
    Dim myRange As Range
    Dim rngZelle As Range
    Dim k As Range
    Dim strComment As String
    Dim Tag As String
    Dim LRow As Long
    
    Loeschen
    
    Set myRange = Sheets("Sheet1").Range("A4:NB4")
    
    With Sheets("Sheet2")
        LRow = .Cells(.Rows.Count, 26).End(xlUp).Row
    End With
    
    For Each k In Range("K3:K" & LRow)
    For Each rngZelle In myRange
    
    With rngZelle
        If .Value <= k And _
            .Value >= k.Offset(0, -1) Then
            .Interior.ColorIndex = 3
            .Font.ColorIndex = 3
        End If
        If .Value = k Then
            If Not .Comment Is Nothing Then
                .Comment.Delete
            End If
            strComment = k.Offset(0, -6)
            .AddComment strComment
            .Comment.Visible = True
            .Comment.Shape.TextFrame.AutoSize = True
            Sheets("Sheet1").Select
            .Comment.Shape.Select True
            Selection.ShapeRange.Top = 100
            Selection.ShapeRange.Left = .Left
        End If
    End With
    Next rngZelle
    Next k
    
    End Sub

    Situation:

    This code marks given events in "K" in a timeline at the right place in the year - okay!
    But unfortunately it does not only mark the given date (inrow "k") in the timeline. It marks the whole timeline...


    Would you be so kind to adopt the code that only the date which is given in row "K" is marked?
    It is not necessary to mark a period. It should just show what is in row "K".


    Thank you in advance from Germany
    Last edited by Julian Schubert; 06-22-2011 at 05:33 AM.

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