Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What would be the correct code for the following macro:
Sub Calc() If [B13] < [D3] + 1 Then [D13] = [D5] + 1 End If If [B13] [D3] Then [D13] = [D5] End If If [B13] = 0 Then [D13] = [D5] End If End Sub All cells are numeric values 0 up |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 10 Jul 2011 16:18:40 -0700 (PDT), " wrote:
What would be the correct code for the following macro: Sub Calc() If [B13] < [D3] + 1 Then [D13] = [D5] + 1 End If If [B13] [D3] Then [D13] = [D5] End If If [B13] = 0 Then [D13] = [D5] End If End Sub All cells are numeric values 0 up Perhaps: Select Case [b13] Case Is < [d3] + 1 [d13] = [d5] + 1 Case Is = 0 Or [d5] [d13] = [d5] End Select |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What would be the correct code for the following macro:
Sub Calc() If [B13] < [D3] + 1 Then [D13] = [D5] + 1 End If If [B13] [D3] Then [D13] = [D5] End If If [B13] = 0 Then [D13] = [D5] End If End Sub All cells are numeric values 0 up What about if [B13] = [D3]? Or was that what you meant to type for your last If..Then statement? Assuming that is what you meant, try this... [D13] = [D5] - ([B13] < [D3] + 1) Rick Rothstein (MVP - Excel) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What would be the correct code for the following macro:
Sub Calc() If [B13] < [D3] + 1 Then [D13] = [D5] + 1 End If If [B13] [D3] Then [D13] = [D5] End If If [B13] = 0 Then [D13] = [D5] End If End Sub All cells are numeric values 0 up What about if [B13] = [D3]? Or was that what you meant to type for your last If..Then statement? Assuming that is what you meant, try this... [D13] = [D5] - ([B13] < [D3] + 1) Actually, in looking at what you wrote more carefully, I think you might actually want this (I'm assuming your numbers are always whole numbers)... [D13] = [D5] - (([B13] < [D3] + 1) And ([B13] < 0)) Rick Rothstein (MVP - Excel) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help on coding please? | Excel Programming | |||
Help on coding please | Excel Programming | |||
Can this be done with coding? | Excel Programming | |||
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? | Excel Programming | |||
Implant macro coding into ASP coding | Excel Programming |