Thema Datum  Von Nutzer Rating
Antwort
13.05.2014 13:01:54 Gast43005
NotSolved
13.05.2014 13:04:22 Corina
NotSolved
13.05.2014 13:11:08 Gast25260
NotSolved
13.05.2014 16:57:04 Gast91973
***
NotSolved
Rot Formen in Abhängigkeit von Variable positionieren
13.05.2014 17:50:00 Gast60961
*****
Solved
14.05.2014 14:06:31 Corina
NotSolved
14.05.2014 15:55:46 Guest60961
NotSolved

Ansicht des Beitrags:
Von:
Gast60961
Datum:
13.05.2014 17:50:00
Views:
1298
Rating: Antwort:
 Nein
Thema:
Formen in Abhängigkeit von Variable positionieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Option Explicit
Const myShpType As Long = 5           'Shp Type rounded rectangle
Const myShpWidt As Single = 160.5
Const myShpHgth As Single = 19.5
 
Const fstShpTop As Single = 276.4688
Const fstShpLft As Single = 211.5
Const fstShpGap As Single = 29.2243
 
Const StartData As String = "D3"
 
Dim wshData As Worksheet
Dim wshSpap As Worksheet
Dim IsExist As Boolean                'shape is in stock
 
Sub HoldMyShapes()
'it´s better to prepare shapes with ID´s for the future
Dim rngData As Range, c As Range
 
  Set wshData = ActiveWorkbook.Sheets("Lists")
  Set wshSpap = ActiveWorkbook.Sheets("Checklist Structure")
   
  Set rngData = wshData.Range(StartData).CurrentRegion
   
  For Each c In rngData
    If c.Font.Bold Then
      ElseIf c.Font.Italic Then
    Else
      IsExist = False
      If Len(Trim(c.Value)) > 0 Then
        FishMyShape c
        If Not IsExist Then MakeShape c
      End If
    End If
  Next c
 
End Sub
 
Private Sub MakeShape(myCell As Range)
Dim myTop As Single
Dim myLft As Single
Dim oShp As Object
 
  myTop = CSng(fstShpTop + fstShpGap * (myCell.row - Range(StartData).row))
  myLft = fstShpLft * (1 + (myCell.column - Range(StartData).column))
   
  Set oShp = wshSpap.Shapes.AddShape(myShpType, myLft, myTop, myShpWidt, myShpHgth)
   
  With oShp 'shape properties, style, macros etc.
     .TextFrame2.TextRange.Characters.Text = myCell.Text
     .Fill.ForeColor.RGB = RGB(255, 255, 255)
     .TextFrame2.VerticalAnchor = msoAnchorMiddle
     .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(112, 48, 160)
     .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignCenter
     .OnAction = "'" & ThisWorkbook.Name & "'!RoundedRectangleSubcategory_Click"
     'prepare with ID for the future (ID = Type & DataCell.Address)
     .Name = Format(myShpType, "000") & Replace(myCell.Address, "$", "")
  End With
End Sub
 
Private Sub FishMyShape(myCell As Range)
Dim Test
Dim strgShapeID As String
   
  'ID = Type & DataCell.Address - present ?
  strgShapeID = Format(myShpType, "000") & Replace(myCell.Address, "$", "")
  On Error GoTo errorhandler
  Test = wshSpap.Shapes(strgShapeID).Top
  IsExist = True
Exit Sub
errorhandler:
CareMyShape myCell.Text, strgShapeID
End Sub
 
Private Sub CareMyShape(myText As String, myID As String)
'prepare shapes with ID for the future (ID = Type & DataCell.Address)
Dim oShp As Shape
  For Each oShp In wshSpap.Shapes
    If oShp.AutoShapeType = myShpType Then
      If oShp.TextFrame2.TextRange.Characters.Text = myText Then
        oShp.Name = myID
        IsExist = True
        Exit Sub
      End If
    End If
  Next oShp
End Sub

 


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
13.05.2014 13:01:54 Gast43005
NotSolved
13.05.2014 13:04:22 Corina
NotSolved
13.05.2014 13:11:08 Gast25260
NotSolved
13.05.2014 16:57:04 Gast91973
***
NotSolved
Rot Formen in Abhängigkeit von Variable positionieren
13.05.2014 17:50:00 Gast60961
*****
Solved
14.05.2014 14:06:31 Corina
NotSolved
14.05.2014 15:55:46 Guest60961
NotSolved