Thread: Coding
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default 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