![]() |
Coding
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 |
Coding
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 |
Coding
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) |
Coding
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) |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com