Please help with loop
you got further than i did!
i don't know what your conditions are that you want to "OR", but you
use "OR" in the same way you use "AND".
if condition1 AND (condition2 OR condition3) then
example:
If chkBoolean.Value = True And _
(optCouponsOnly.Value = True Or _
optSchedCoupons.Value = True) Then
so who was helping who, anyway? :)
i'm glad you got it worked out.
susan
On Mar 1, 9:59 am, wrote:
Hello Susan
I made your script like this, this can summing the collumn 3 but how
can i use or in if condition?
Option Explicit
'value van column c optellen en plaats productkop na 51
Sub sikkens()
Dim rHeight As Integer
Dim rHeightvolg As Integer
Dim rRow As Range
Dim rowCount As Long
Dim ws As Worksheet
Dim itemDesign As String
Dim itemrow As Integer
Set ws = ActiveSheet
rHeight = 0
rowCount = 0
For Each rRow In ws.Rows
If rowCount 0 Then
If rRow.Cells(1).Value = "" Then
Exit For
End If
rHeight = rHeight + CInt(rRow.Cells(3).Value)
itemDesign = rRow.Cells(2).Text
itemrow = rRow.Cells(2).Row
'MsgBox rHeight & itemDesign & itemrow & bla
If rHeight = 51 And itemDesign = "ArtikelAfb" Or rHeight =
60 Then
Rows(itemrow).Insert
Rows(rHeight - 1).Cells(1).Value = ""
Rows(rHeight - 1).Cells(2).Value = "ProductKop"
Rows(rHeight - 1).Cells(3).Value = "1"
Rows(rHeight - 1).Cells(4).Value = "1"
Rows(rHeight - 1).Cells(5).Value = "NEXTP"
Rows(rHeight - 1).Cells(6).Value =
rRow(2).Cells(6).Text
ElseIf rHeight = 111 And itemDesign = "ArtikelAfb" Or
rHeight = 120 Then
Rows(itemrow).Insert
Rows(rHeight - 1).Cells(1).Value = ""
Rows(rHeight - 1).Cells(2).Value = "ProductKop"
Rows(rHeight - 1).Cells(3).Value = "1"
Rows(rHeight - 1).Cells(4).Value = "1"
Rows(rHeight - 1).Cells(5).Value = "NEXTP"
Rows(rHeight - 1).Cells(6).Value = rRow.Cells(6).Text
ElseIf rHeight = 171 And itemDesign = "ArtikelAfb" Or
rHeight = 180 Then
Rows(itemrow).Insert
Rows(rHeight - 1).Cells(1).Value = ""
Rows(rHeight - 1).Cells(2).Value = "ProductKop"
Rows(rHeight - 1).Cells(3).Value = "1"
Rows(rHeight - 1).Cells(4).Value = "1"
Rows(rHeight - 1).Cells(5).Value = "NEXTP"
Rows(rHeight - 1).Cells(6).Value = rRow.Cells(6).Text
ElseIf rHeight = 231 And itemDesign = "ArtikelAfb" Or
rHeight = 240 Then
Rows(itemrow).Insert
Rows(rHeight - 1).Cells(1).Value = ""
Rows(rHeight - 1).Cells(2).Value = "ProductKop"
Rows(rHeight - 1).Cells(3).Value = "1"
Rows(rHeight - 1).Cells(4).Value = "1"
Rows(rHeight - 1).Cells(5).Value = "NEXTP"
Rows(rHeight - 1).Cells(5).Value = rRow.Cells(5).Text
'MsgBox ("row num=" & rRow.Cells(1).Value)
'Exit For
End If
End If
rowCount = rowCount + 1
Next rRow
End Sub
|