PC Review


Reply
 
 
eenglish@suddenlink.net
Guest
Posts: n/a
 
      11th Jul 2011
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


 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      11th Jul 2011
> 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)

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      11th Jul 2011
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding help RGlade Microsoft Word Document Management 2 14th Sep 2009 02:44 PM
VB Coding AlbertaRose Microsoft Access VBA Modules 2 24th Mar 2008 10:21 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan Microsoft Excel Programming 10 6th Oct 2005 01:18 PM
coding help dxiong Microsoft Access 3 27th Jul 2004 11:17 PM
Problems with coding and coding question!! James Microsoft Access Form Coding 0 23rd Feb 2004 10:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.