Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2006

Tip: Looking for answers? Try searching our database.

If-Then-Else Statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
loren.pottinger - 05 Sep 2006 20:01 GMT
It is not executing my If-Then-Else statement.
It seems the only statement being executed is: Cells(Row, Col).Value =
Range("K" & Row) and I only want it to do that if the condition is
true, and put a 0 in each cell in the range if it is false. Can someone

please look at my code and help me to get it to execute the
If-Then-Else statement. Thank you. Updated code as follows:

Sub Fill()

   Dim TestDate As Date
   Dim Col As Integer
   Dim Row As Long

       For Col = 13 To 29
           For Row = 7 To 63

               With TestDate = DateAdd("m", Range("F" & Row).Value, _
               Range("H" & Row).Value)

                   If TestDate < Range("I" & Row).Value Then
                   Cells(Row, Col).Value = Range("K" & Row)
                   Range("F" & Row).Value = Range("F" & Row).Value - 1

                   Else
                   Cells(Row, Col).Value = 0
                   Range("F" & Row).Value = Range("F" & Row).Value - 1

                   End If
               End With

           Next Row
       Next Col
End Sub
Dave Peterson - 05 Sep 2006 20:12 GMT
You've posted this same question to multiple newsgroups.  Which thread should
get the answers?

> It is not executing my If-Then-Else statement.
> It seems the only statement being executed is: Cells(Row, Col).Value =
[quoted text clipped - 30 lines]
>         Next Col
> End Sub

Signature

Dave Peterson

loren.pottinger - 05 Sep 2006 20:16 GMT
Misc I suppose

> You've posted this same question to multiple newsgroups.  Which thread should
> get the answers?
[quoted text clipped - 33 lines]
> >         Next Col
> > End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.