Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jodon Brown   on Sep 04 In MS Office Category.

  
Question Answered By: Jake Williams   on Sep 04

Your decision logic using the SelectCase function is easier to debug or
troubleshoot!

If you insist on less lines  of code; see if this gets you what you are looking
for:


vValue = Me.TextBox1.Value
vLogicSum = 3 + (((vValue < 2)*1) + ((vValue<=4)*1))
Me.TextBox1.BackColor = Choose ( vLogicSum, &H80FF80, &H80FFFF, &HFF )

You can take it 1 step further by replacing the vLogicSum variable in line3 with
its expression from line2; then removing line 2.

As you can see, the original code is simpler to debug than the solution
provided!

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Avoid multiple select constructs Or get search suggestion and latest updates.


Tagged: