Home |
Search |
Today's Posts |
#16
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
insert row / insert column command buttons | Excel Worksheet Functions | |||
How can I insert a date with an icon (calendar) insert | Excel Discussion (Misc queries) | |||
Macro to insert copy and insert formulas only to next blank row | Excel Programming | |||
Can I auto insert a worksheet when I insert a value in a cell. | Excel Worksheet Functions | |||
Insert cell/format/text/fontsize and auto insert into header? | Excel Programming |