Thema Datum  Von Nutzer Rating
Antwort
27.05.2014 11:59:43 Thomas
NotSolved
27.05.2014 22:53:34 Gast86706
NotSolved
28.05.2014 11:34:17 Gast91444
NotSolved
28.05.2014 21:59:32 Gast5735
NotSolved
Rot nette Spielerei
28.05.2014 22:37:22 Gast66671
NotSolved
29.05.2014 11:12:50 Gast95269
NotSolved
02.06.2014 07:53:54 Thomas
NotSolved
03.06.2014 04:50:03 Gast95269
NotSolved

Ansicht des Beitrags:
Von:
Gast66671
Datum:
28.05.2014 22:37:22
Views:
987
Rating: Antwort:
  Ja
Thema:
nette Spielerei

Hallo,

hab' ich fast befürchtet,
das macht das ganze etwas komplexer,
da Du alle Positionen  einzeln ansprechen mußt:
(Dazu ist der Kommentar eigentlich nicht unbedingt geeignet..)

Option Explicit

Private strBlattname As String
Private strKommentar As String
 
Public Sub InhaltAuslesen(ByVal intRow As Integer)
strBlattname = "Sheet1"  'SheetName  anpassen!!!
 With Worksheets(strBlattname)
    strKommentar = _
    .Cells(1, 2).Value & String$(10, " ") & .Cells(1, 3).Value & Chr(10) _
    & .Cells(intRow, 2).Value & String$(12, " ") & .Cells(intRow, 3).Value & Chr(10) & Chr(10) _
    & .Cells(1, 9).Value _
    & String$(20, " ") _
    & .Cells(1, 4).Value & Chr(10) _
    & .Cells(intRow, 9).Value & .Cells(intRow, 10).Value _
    & String$(16, " ") _
    & .Cells(intRow, 4).Value & Chr(10) & Chr(10) _
    & .Cells(1, 6).Value & Chr(10) & .Cells(intRow, 6).Value & Chr(10) & Chr(10) _
    & .Cells(1, 5).Value & Chr(10) & .Cells(intRow, 5).Value & Chr(10) & Chr(10) _
    & .Cells(1, 8).Value & Chr(10) & .Cells(intRow, 8).Value & Chr(10) _
    & .Cells(1, 7).Value & Chr(10) & .Cells(intRow, 7).Value
End With
Call CreateComment(intRow)
End Sub

Public Sub CreateComment(ByVal intRow As Integer)
Dim objComment As Comment
Dim lngIndex As Long, lngMax As Long
Dim lngArrStart(1 To 2) As Long, _
  lngArrLength(1 To 2) As Long
With Worksheets("Sheet2").Cells(2, 2)
    If Not .Comment Is Nothing Then Exit Sub
    Set objComment = .AddComment(strKommentar)
End With
With objComment.Shape.TextFrame
    With .Characters.Font
        .Bold = True
        .Underline = xlUnderlineStyleSingle
    End With
    If intRow > 1 Then _
      lngMax = 7 _
    Else: lngMax = 4
    For lngIndex = 1 To lngMax
       With Worksheets(strBlattname)
           Select Case lngIndex
               Case Is = 1
                  lngArrStart(1) = Len(.Cells(1, 2).Text) + 1: lngArrLength(1) = 10
                  If intRow > 1 Then
                    lngArrStart(2) = Len(.Cells(1, 2).Text) + 10 + _
                       Len(.Cells(1, 3).Text) + 2
                    lngArrLength(2) = Len(.Cells(intRow, 2).Text)
                  End If
               Case Is = 2
                  lngArrStart(1) = lngArrStart(1) + lngArrLength(1) + Len(.Cells(1, 3).Text) _
                      + Len(.Cells(intRow, 2).Text) + 1
                  lngArrLength(1) = 12
                  If intRow > 1 Then
                    lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 12
                    lngArrLength(2) = Len(.Cells(intRow, 3).Text)
                  End If
               Case Is = 3
                  lngArrStart(1) = lngArrStart(1) + lngArrLength(1) + Len(.Cells(intRow, 3).Text) + _
                      2 + Len(.Cells(1, 9).Text)
                  lngArrLength(1) = 20
                  If intRow > 1 Then
                    lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 2 + Len(.Cells(1, 9).Text) + _
                       20 + Len(.Cells(1, 4).Text)
                    lngArrLength(2) = Len(.Cells(intRow, 9).Text) + Len(.Cells(intRow, 10).Text) + _
                       16 + Len(.Cells(intRow, 4).Text) + 2
                  End If
               Case Is = 4
                  lngArrStart(1) = lngArrStart(1) + lngArrLength(1) + Len(.Cells(1, 4).Text) + _
                       1 + Len(.Cells(intRow, 9).Text) + Len(.Cells(1, 10).Text)
                  lngArrLength(1) = 16
                  If intRow > 1 Then
                    lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 1 + Len(.Cells(1, 6).Text) + 1
                    lngArrLength(2) = Len(.Cells(intRow, 6).Text)
                  End If
               Case Is = 5
                  lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 2 + Len(.Cells(1, 5).Text) + 1
                  lngArrLength(2) = Len(.Cells(intRow, 5).Text)
               Case Is = 6
                  lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 2 + Len(.Cells(1, 8).Text) + 1
                  lngArrLength(2) = Len(.Cells(intRow, 8).Text)
               Case Is = 7
                  lngArrStart(2) = lngArrStart(2) + lngArrLength(2) + 1 + Len(.Cells(1, 7).Text) + 1
                  lngArrLength(2) = Len(.Cells(intRow, 7).Text)
           End Select
       End With
       If lngIndex <= 4 Then _
         .Characters(Start:=lngArrStart(1), Length:=lngArrLength(1)).Font.Underline = xlUnderlineStyleNone
       If intRow > 1 Then
         With .Characters(Start:=lngArrStart(2), Length:=lngArrLength(2)).Font
             .Bold = False
             .Underline = xlUnderlineStyleNone
         End With
       End If
    Next
End With
Set objComment = Nothing
End Sub

Gruß,


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
27.05.2014 11:59:43 Thomas
NotSolved
27.05.2014 22:53:34 Gast86706
NotSolved
28.05.2014 11:34:17 Gast91444
NotSolved
28.05.2014 21:59:32 Gast5735
NotSolved
Rot nette Spielerei
28.05.2014 22:37:22 Gast66671
NotSolved
29.05.2014 11:12:50 Gast95269
NotSolved
02.06.2014 07:53:54 Thomas
NotSolved
03.06.2014 04:50:03 Gast95269
NotSolved