Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

writing VBA for excel

  Asked By: Linda    Date: Nov 19    Category: MS Office    Views: 890
  

I don't have much education on
writing VB so I apologize for hassling anyone just looking for some
pointers on some reading material to help me learn.

Also, besides some good reference books, I'm trying to program an if
then statement into VB for excel so that when a date is entered into
cell j3 a forumal is run in cell k3 that compares the difference in
dates from j3 and todays date. (Today's date function is run in cell
a1.) If the difference is greater than 7 then cell k3 is
highlighted red. If soemoen can point me down the right path on
this I would greatly appreciate.

I'm running into issues with this because I don't know the language
well enough to tell excel what I want it to do.

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Seth Anderson     Answered On: Nov 19

I have/am looking at _Excel_VBA_Programming_for_Dummies_ and
_Visual_Basic-6 amongst my Excel references that might fit what you are
looking for. Helps me! (usually...)

 
Answer #2    Answered By: Jeanne Lawson     Answered On: Nov 19

if this is all you need, it would be better if your work with the
"conditional format" in the "format" menu.

 
Answer #3    Answered By: Reamonn Fischer     Answered On: Nov 19

You can also check out this website, as it has many computer programming books,
as well as many classroom instructional books.
http://www.flazx.com

 
Answer #4    Answered By: Aaron Evans     Answered On: Nov 19

I tried using conditional format. I inserted a column designated as
difference and ran a formula to determine the number of days.
Problem is that if no date  is entered  you get an answer of 3287. So
by using conditional format all of the cells will automatically
highlight red  even if a date hasn't been entered yet. This is not
exactly what I need as it eliminates the point of highlighting
delinquencies over 7 days.

I was tryign to think of a if then statement  to cover the issue.
example:

Sub
If J2 is empty
Then True
If True
Then run  compare

With
If A1-J2>=7
Then statement=(true)
If true
Then run flag

I know my coding is incorrect. Just trying to explain what I'm
trying to accomplish.

 
Answer #5    Answered By: Salvatore Kelly     Answered On: Nov 19

I couldn't understand what your are trying but you can write the if as a
formula in the column for differences

Continuing with your first example in k3 you can write =if(j3="",0,J3-A1)

Then you try again with the conditional formant

 
Didn't find what you were looking for? Find more on writing VBA for excel Or get search suggestion and latest updates.




Tagged: