Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
880to884
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
880to884
880to884
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
If (Zelle A2) <> dann
29.06.2007 15:19:20
Boris
Hi
es ist mir fast peinlich zu fragen, aber ich komm nicht mehr drauf.
Ich habe in jeder Tabelle in der Zelle A2 die Bezeichnung der Tabelle stehen. Jetzt soll per VBA abegefragt werden, ob in der Tabelle xy meinetwegen der String "Summen (Zielrufnummern)" und dann soll der Rest erst ausgeführt werden.
Wie frag ich diesen Zelleninhalt ab?

6
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: If (Zelle A2) <> dann
29.06.2007 15:21:56
Hajo_Zi
Hallo Boris,
=Wenn(A1="Summen (Zielrufnummern)";mach dies"; "ansonsten das")

AW: If (Zelle A2) <> dann
29.06.2007 15:34:54
Boris
Hi Hajo,
danke, aber das hätte ich jetzt gerne in VBA in einer if Schleife:-(

AW: If (Zelle A2) <> dann
29.06.2007 15:37:31
Hajo_Zi
Halo Boris,
es ist immer Klasse wenn man das schon im ersten Beitrag schreibt, dann wurde nicht für den Papierkorb gearbeitet.
If Range("A1")="Summen (Zielrufnummern)" Then
Msgbox mach dies"
else
Msgbox "ansonsten das"
End if
Gruß Hajo

Anzeige
AW: If (Zelle A2) <> dann
29.06.2007 15:52:00
Boris
Oh...sorry...
Fällt mir manchmal ein wenig schwer, solche Probleme so zu schildern, daß andere direkt verstehen was ich meine.
Aber es klappt immer noch nicht...wie schon gesagt...VBA in Excel ist leider noch ziemliches Neuland. So sieht es bis jetzt aus. Sicherlich verbesserbar :-(

Public Sub Diagramm_Summen_Zeilrufnummern()
Dim Bereich As Range, s As String
Set Bereich = Range("B10:E21, G10:G21")
s = ActiveSheet.Name
If Range("A1") = "Summen (Zielrufnummern)" Then
Charts.Add
ActiveChart.ChartType = xl3DColumn
ActiveChart.SetSourceData Source:=Bereich, PlotBy:=xlRows
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = s
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(4).Select
ActiveChart.SeriesCollection(4).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(5).Select
ActiveChart.SeriesCollection(5).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(6).Select
ActiveChart.SeriesCollection(6).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(7).Select
ActiveChart.SeriesCollection(7).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(8).Select
ActiveChart.SeriesCollection(8).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(9).Select
ActiveChart.SeriesCollection(9).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(10).Select
ActiveChart.SeriesCollection(10).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(11).Select
ActiveChart.SeriesCollection(11).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
ActiveChart.SeriesCollection(12).Select
ActiveChart.SeriesCollection(12).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
'ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.SeriesCollection(1).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(2).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(2).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(2).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
'ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(4).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(4).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(4).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(5).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(5).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(5).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(6).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(6).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(6).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(7).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(7).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(7).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(8).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(8).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(8).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(9).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(9).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(9).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(10).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(10).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(10).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(11).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(11).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(11).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(12).Points(2).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(12).Points(3).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(12).Points(4).DataLabel.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = True
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.Walls.Select
ActiveChart.Corners.Select
With ActiveChart
.Elevation = 13
.Rotation = 71
End With
ActiveChart.PlotArea.Select
Selection.Width = 670
Selection.Height = 398
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
Selection.Top = 27
Selection.Width = 699
Selection.Height = 419
ActiveChart.Legend.Select
Selection.Top = 127
Selection.Height = 210
Else
MsgBox ("Bitte die Tabelle -Summen(Zielrufnummern)- öffnen"), vbOKOnly, ("Falsche  _
Ausgangstabelle")
End If
End Sub


Anzeige
AW: If (Zelle A2) <> dann
29.06.2007 16:01:10
Hajo_Zi
Hallo Boris,
was soll nun diese Ellenlange Code wichtifg sind doch nur die ersten paar Zeile. Eine Datei wäre besser gwesen. ein Nachbau sieht immer anders aus als das Original.
Gruß Hajo

AW: If (Zelle A2) <> dann
29.06.2007 16:10:00
Boris
Hmmm... irgendwie fehlr hier ein Beitrag...
Aber trotzdem vielen Dank. Es funktioniert jetzt, hab mich nur zu blöd gestellt;-)
Du hast sozusagen mein Wochenende gerettet.

300 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige