LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
Macro to insert copy and insert formulas only to next blank row bob Excel Programming 0 June 30th 06 12:02 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
Insert cell/format/text/fontsize and auto insert into header? Unfurltheflag Excel Programming 2 November 3rd 04 05:39 PM


All times are GMT +1. The time now is 03:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"