Thema Datum  Von Nutzer Rating
Antwort
30.12.2012 21:32:41 timi
Solved
31.12.2012 19:05:29 Trägheit
NotSolved
01.01.2013 20:33:35 Gast42162
NotSolved
01.01.2013 21:02:54 Gast47955
NotSolved
01.01.2013 21:20:56 Gast86138
NotSolved
02.01.2013 01:15:50 timi
NotSolved
02.01.2013 11:31:16 Trägheit
NotSolved
02.01.2013 23:14:17 timi
NotSolved
02.01.2013 23:20:59 timi
NotSolved
03.01.2013 14:02:37 Gast6953
NotSolved
03.01.2013 15:01:58 timi
NotSolved
03.01.2013 14:57:02 Trägheit
NotSolved
03.01.2013 15:10:18 timi
NotSolved
03.01.2013 15:29:29 Gast38708
NotSolved
03.01.2013 15:39:36 timi
NotSolved
03.01.2013 16:09:25 Gast87080
NotSolved
03.01.2013 16:28:22 timi
NotSolved
03.01.2013 22:16:00 Trägheit
NotSolved
03.01.2013 23:50:02 timi
NotSolved
04.01.2013 14:35:53 Gast69606
NotSolved
04.01.2013 15:13:57 timi
NotSolved
Blau Dringend Hilfe mit der Umformatierung der Daten
04.01.2013 18:47:41 Trägheit
NotSolved
04.01.2013 19:17:00 timi
NotSolved
05.01.2013 06:47:18 Trägheit
Solved
05.01.2013 11:03:27 timi
NotSolved
05.01.2013 18:05:58 Trägheit
NotSolved
05.01.2013 18:22:01 timi
NotSolved
05.01.2013 13:43:31 alex
NotSolved
05.01.2013 20:46:23 Trägheit
NotSolved
06.01.2013 00:59:12 alex
NotSolved
06.01.2013 15:12:10 Gast47772
NotSolved
06.01.2013 15:45:40 alex
NotSolved
07.01.2013 19:06:01 Gast50417
NotSolved
03.01.2013 23:56:30 timi
NotSolved

Ansicht des Beitrags:
Von:
Trägheit
Datum:
04.01.2013 18:47:41
Views:
1354
Rating: Antwort:
  Ja
Thema:
Dringend Hilfe mit der Umformatierung der Daten
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
Option Explicit
 
Sub Transp()
    
  Dim wksSum        As Excel.Worksheet 'Zusammenfassung aller Daten
  Dim wks           As Excel.Worksheet
  Dim bCopyHeader   As Boolean
   
  Set wksSum = Tabelle3
   
  bCopyHeader = True
   
  wksSum.UsedRange.Clear
   
  For Each wks In ThisWorkbook.Worksheets
    If wks.Name Like "CB_*" _
    Or wks.Name Like "DOM_*" _
    Then
      'Daten der Zusammenfassung hinzufügen
      Call JoinRecordsets(wks, wksSum, bCopyHeader)
      bCopyHeader = False 'einmal Kopfzeile genügt ;)
    End If
  Next
   
  'Datensätze erweitern (bestimmte Spalten werden aufgeteilt)
  Call ExpandRecordsets(wksSum)
   
  Call MsgBox("Fertig.", vbInformation)
   
End Sub
 
'////////////////////////////////////////////
'// Erweitert die Daten um zusätzliche Spalten
Private Sub ExpandRecordsets(Worksheet As Excel.Worksheet)
    
  Dim rng As Excel.Range
  Dim strOrganisation$, strCountry$, strSector$
  Dim vntField()
  Dim i As Long
    
  vntField = Array("Target", "Acquiror", "Vendor") 'die "aufzudröselnden" Spalten
   
  'Prüfung ob die Felder alle vorhanden sind
  For i = LBound(vntField) To UBound(vntField)
    Set rng = Worksheet.Rows(1).Find(vntField(i), LookIn:=xlValues, LookAt:=xlWhole)
    If rng Is Nothing Then
      Call MsgBox("Spalte mit Titel '" & vntField(i) & "' in Arbeitsblatt '" & Worksheet.Name & "' nicht gefunden.", _
                  vbCritical, _
                  "Daten-Erweiterung abgebrochen")
      Exit Sub
    End If
  Next
   
  'Spalten hinzufügen und befüllen
  For i = LBound(vntField) To UBound(vntField)
      
    'Spalte suchen
    Set rng = Worksheet.Rows(1).Find(vntField(i), LookIn:=xlValues, LookAt:=xlWhole)
      
    'zusätzliche Spalten einfügen und Betiteln
    rng.Offset(, 1).Resize(, 2).EntireColumn.Insert xlShiftToRight
    rng.Offset(, 1).Value = "Industry of " & rng.Text
    rng.Offset(, 2).Value = "Country of " & rng.Text
      
    'Zeile für Zeile Daten in dieser Spalte schreiben...
    Set rng = rng.Offset(1)
    While rng.Text <> ""
      If rng.Text <> "" And rng.Text <> "-" Then
        If Extract(rng.Text, strOrganisation, strCountry, strSector) Then
          rng.Value = strOrganisation
          rng.Offset(, 1).Value = strSector
          rng.Offset(, 2).Value = strCountry
        Else
        'FEHLER: Ausdruck konnte nicht ausgewertet werden
          rng.Resize(, 3).Font.Color = vbRed
          rng.Resize(, 3).Font.Bold = True
          rng.Offset(, 1).Value = CVErr(xlErrNA)
          rng.Offset(, 2).Value = CVErr(xlErrNA)
        End If
      Else
      'kein Ausdruck zum auswerten
        rng.Offset(, 1).Value = "-"
        rng.Offset(, 2).Value = "-"
      End If
       
      Set rng = rng.Offset(1)
    Wend
      
  Next
    
End Sub
 
'////////////////////////////////////////////
'// Fügt Datensätze zu einem zusammen
Private Sub JoinRecordsets(Source As Excel.Worksheet, Destination As Excel.Worksheet, Optional Header As Boolean)
   
  Const C_SPREADSHEET$ = "Spreadsheet"
   
  If Header Then
    Source.Rows(1).Copy Destination.Rows(1)
    With Destination.UsedRange.Rows(1).End(xlToRight)
      .Copy
      .Offset(, 1).PasteSpecial xlPasteFormats
      .Offset(, 1).Value = C_SPREADSHEET
      Application.CutCopyMode = False
    End With
  End If
   
  Dim rngS As Excel.Range
  Dim rngD As Excel.Range
  Dim rngSS As Excel.Range
   
  Set rngS = Source.UsedRange
  If rngS.Rows.Count = 1 Then Exit Sub                  'wenn es nichts zum kopieren gibt -> Exit
  Set rngS = rngS.Offset(1).Resize(rngS.Rows.Count - 1) 'zu kopierende Datensätze
      
  Set rngD = Destination.UsedRange
  Set rngD = rngD.Rows(rngD.Rows.Count).Offset(1) 'erste leere Zeile
   
  Call rngS.Copy(rngD) 'kopieren, wär hätte es geahnt... ;)
   
  Set rngSS = Destination.Rows(1).Find(C_SPREADSHEET, LookIn:=xlValues, LookAt:=xlWhole)
  If Not rngSS Is Nothing Then
    Set rngSS = Intersect(rngD.EntireRow, rngSS.EntireColumn)
    rngSS.Value = Source.Name
  End If
   
End Sub
  
'////////////////
'// Extrahiert Informationen aus einer Zeichenkette
'IN : Str
'OUT: Organisation, Country, Sector
'RET: True/False
Function Extract(str As String, Organisation As String, Country As String, Sector As String) As Boolean
     
  Dim bFlag(1 To 3) As Boolean
  Dim tmp$
  Dim i&
     
  For i = 1 To Len(str)
       
    Select Case Mid$(str, i, 1)
      Case "("
        If bFlag(1) Then Exit Function
         
        bFlag(1) = True
        Organisation = Trim$(tmp)
        tmp = ""
           
      Case ")"
        If bFlag(3) Or Not (bFlag(1) And bFlag(2)) Or Len(Trim$(tmp)) = 0 _
          Then Exit Function
         
        bFlag(3) = True
        Country = Trim$(tmp)
        tmp = ""
        Exit For
         
      Case "-"
        If bFlag(2) Or bFlag(3) Or Len(Trim$(tmp)) = 0 _
          Then Exit Function
         
        If bFlag(1) Then
          bFlag(2) = True
          Sector = Trim$(tmp)
          tmp = ""
        Else
          tmp = tmp & "-"
        End If
           
      Case Else
        tmp = tmp & Mid$(str, i, 1)
           
    End Select
  Next
     
  Extract = True
     
End Function

 


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
30.12.2012 21:32:41 timi
Solved
31.12.2012 19:05:29 Trägheit
NotSolved
01.01.2013 20:33:35 Gast42162
NotSolved
01.01.2013 21:02:54 Gast47955
NotSolved
01.01.2013 21:20:56 Gast86138
NotSolved
02.01.2013 01:15:50 timi
NotSolved
02.01.2013 11:31:16 Trägheit
NotSolved
02.01.2013 23:14:17 timi
NotSolved
02.01.2013 23:20:59 timi
NotSolved
03.01.2013 14:02:37 Gast6953
NotSolved
03.01.2013 15:01:58 timi
NotSolved
03.01.2013 14:57:02 Trägheit
NotSolved
03.01.2013 15:10:18 timi
NotSolved
03.01.2013 15:29:29 Gast38708
NotSolved
03.01.2013 15:39:36 timi
NotSolved
03.01.2013 16:09:25 Gast87080
NotSolved
03.01.2013 16:28:22 timi
NotSolved
03.01.2013 22:16:00 Trägheit
NotSolved
03.01.2013 23:50:02 timi
NotSolved
04.01.2013 14:35:53 Gast69606
NotSolved
04.01.2013 15:13:57 timi
NotSolved
Blau Dringend Hilfe mit der Umformatierung der Daten
04.01.2013 18:47:41 Trägheit
NotSolved
04.01.2013 19:17:00 timi
NotSolved
05.01.2013 06:47:18 Trägheit
Solved
05.01.2013 11:03:27 timi
NotSolved
05.01.2013 18:05:58 Trägheit
NotSolved
05.01.2013 18:22:01 timi
NotSolved
05.01.2013 13:43:31 alex
NotSolved
05.01.2013 20:46:23 Trägheit
NotSolved
06.01.2013 00:59:12 alex
NotSolved
06.01.2013 15:12:10 Gast47772
NotSolved
06.01.2013 15:45:40 alex
NotSolved
07.01.2013 19:06:01 Gast50417
NotSolved
03.01.2013 23:56:30 timi
NotSolved