Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
900to904
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
900to904
900to904
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Zelle aus Range entspricht "Wert"

Zelle aus Range entspricht "Wert"
31.08.2007 10:40:55
Rainer
hallo Leute
ich versuche verzweifelt diesen Code zusammenzukrieben und hab in der Suche nicht schlaues gefunden, obwhol das thema sicherlich schon 100 mal besprochen wrude.

Sub ()
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
If Application.Count(Range(Cells(iRow, 1), Cells(iRow, SpalteEins))) > 0 _
And Range(Cells(iRow, 1), Cells(iRow, SpalteZwei)).vlaue = "Print" Then
Cells(iRow, SpalteDrei) = Cells(iRow, SpalteEins) * Faktor
End If
Next iRow
End Sub


Ich möchte, wenn die Einträge in Spalte 1 grösser Null sind und die Einträge in Spalte zwei deim Eintrag "Print" entsprechen, die geschriebene Aktion durchführen.
Danke für eure Hilfe
Gruss
Rainer

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

Betreff
Datum
Anwender
Anzeige
AW: Zelle aus Range entspricht "Wert"
31.08.2007 10:52:00
Chaos
Servus,
dann mach's doch so:

Sub ()
Dim iRow As Integer '( oder lRow As Long), iRowL As Integer ' oder Long
Dim Faktor As Double ' ?
Dim s As String
Faktor = '? was ist den der Faktor
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
s = Cells(iRow,1).Value
If IsNumeric(s) Then ' Abfrage, ob Zahl
If Cells(iRow, 1).Value > 0 And Cells(iRow, 2).Vlaue = "Print" Then
Cells(iRow, 3) = Cells(iRow, 1) * Faktor
End If
End if
Next iRow
End Sub


Gruß
Chaos

AW: Rechtschreibfehler
31.08.2007 10:54:34
Chaos

Sub ()
Dim iRow As Integer '( oder lRow As Long), iRowL As Integer ' oder Long
Dim Faktor As Double ' ?
Dim s As String
Faktor = '? was ist den der Faktor
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
s = Cells(iRow,1).Value
If IsNumeric(s) Then ' Abfrage, ob Zahl
If Cells(iRow, 1).Value > 0 And Cells(iRow, 2).Value = "Print" Then
Cells(iRow, 3) = Cells(iRow, 1) * Faktor
End If
End if
Next iRow
End Sub


Anzeige
AW: Zelle aus Range entspricht "Wert"
31.08.2007 10:52:00
Renee
Hi Rainer,
Vielleicht so, oder ähnlich:

Sub x()
Const Faktor = 0.5
Dim rc As Range
For Each rc In ActiveSheet.Range(Cells(1, 2), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 2))
If rc.Value = "Print" Then rc.Offset(0, 1) = rc.Offset(0, -1) * Faktor
Next
End Sub


Greetz renee

Programmierfehler
31.08.2007 10:56:00
Renee
Sorry,
hab das mit grösser 0 verpasst:

Sub x()
Const Faktor = 0.5
Dim rc As Range
For Each rc In Range(Cells(1, 2), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 2))
If rc.Value = "Print" And rc.Offset(0, -1) > 0 Then _
rc.Offset(0, 1) = rc.Offset(0, -1) * Faktor
Next
End Sub


Greetz Renee

Anzeige
AW: Zelle aus Range entspricht "Wert"
31.08.2007 11:00:26
Ulf
Hallo Rainer
versuch es mal so

Sub x()
Dim iRow As Integer, iRowL As Long, Faktor As Integer
Faktor = 5
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
If Cells(iRow, 1).Value > 0 And Cells(iRow, 2).Value = "Print" Then
Cells(iRow, 3) = Cells(iRow, 1) * Faktor
End If
Next iRow
End Sub


mfg Ulf

Viele Dank :-)
31.08.2007 11:20:00
Rainer
Es geht ja wieder mal richtig ab hier!
Supervielen Dank für die Überflutung von Antworten.
ich habe zuerst ULF's version versucht (für mich am Einfachsten zu verstehen)
das hat aber nicht geklappt:

Sub SalesTeamFieldSalesLagerFix_V2()
Dim iRowL As Integer, iRow As Integer
Dim SpalteEins As Integer
Dim SpalteZwei As Integer
Dim SpalteDrei As Integer
Dim Faktor As Single
SpalteEins = 53 ' Faktor 1
SpalteZwei = 54 ' Spalte Produkt
SpalteDrei = 5  ' Spalte für Bereichsüberprüfung
Faktor = Worksheets("int Leistungsverrechnung").Range("B93")
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
If Cells(iRow, SpalteEins).Value > 0 And Cells(iRow, SpalteDrei).Value = "Print" Then
Cells(iRow, SpalteZwei) = Cells(iRow, 1) * Faktor
End If
Next iRow
End Sub


Dann habe ich Chaos's Version genommen und die geht jetzt.


Sub SalesTeamFieldSalesLagerFix_V3()
Dim iRowL As Integer, iRow As Integer
Dim SpalteEins As Integer
Dim SpalteZwei As Integer
Dim SpalteDrei As Integer
Dim Faktor As Single
Dim s As String
SpalteEins = 53 ' Faktor 1
SpalteZwei = 54 ' Spalte Produkt
SpalteDrei = 5  ' Spalte für Bereichsüberprüfung
Faktor = Worksheets("int Leistungsverrechnung").Range("B93")
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
s = Cells(iRow, SpalteEins).Value
If IsNumeric(s) Then ' Abfrage, ob Zahl
If Cells(iRow, SpalteEins).Value > 0 And Cells(iRow, SpalteDrei).Value = "Print" Then
Cells(iRow, SpalteZwei) = Cells(iRow, SpalteEins) * Faktor
End If
End If
Next iRow
End Sub


Deine Version Renee ist wohl die eleganteste, aber für mich auch die schwierigste zum verstehen, da ich noch nicht so das gross Know how habe.
Danke nochmals an alle! :-)

Anzeige

302 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige