Results 1 to 18 of 18

VBA loops

Threaded View

Malowle VBA loops 08-01-2012, 06:50 PM
Cutter Re: VBA loops 08-01-2012, 07:17 PM
rylo Re: VBA loops 08-01-2012, 07:27 PM
TMS Re: VBA loops 08-01-2012, 07:37 PM
mikerickson Re: VBA loops 08-01-2012, 08:11 PM
Malowle Re: VBA loops 08-02-2012, 04:05 AM
TMS Re: VBA loops 08-02-2012, 04:16 AM
Malowle Re: VBA loops 08-02-2012, 04:40 AM
TMS Re: VBA loops 08-02-2012, 04:43 AM
Malowle Re: VBA loops 08-02-2012, 05:00 AM
TMS Re: VBA loops 08-02-2012, 05:49 AM
Malowle Re: VBA loops 08-02-2012, 03:51 PM
Malowle Re: VBA loops 09-12-2012, 03:37 PM
Malowle Re: VBA loops 09-12-2012, 03:38 PM
Malowle Re: Excel equation for... 09-12-2012, 03:40 PM
TMS Re: VBA loops 09-12-2012, 04:33 PM
Malowle Loops to calculate the... 09-12-2012, 05:52 PM
TMS Re: VBA loops 09-13-2012, 05:30 PM
  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    Birmigham, UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    VBA loops

    Hi All,

    I am trying to create a loop to count the number of rainy days. If there is no rain the value is 0, but if it rains then the value is <0. I want to add all the days of rain in a year and the value returned should be the total number of rainy days.

    Option explicit 
    
    Dim n1 As Double
    Dim n2 As Double
    Dim minimum As Double
    
    For k = 0 To 365
    
    
    ' Get numbers from the spreadsheet
     n1 = Worksheets("Rainfall").Cells(k + 2, 3)
    
     
    ' find the number of rainy days
    If n1 > 0 Then
      n1 = rainyday
    Else
      n1 = n2
    End If

    Thanks
    Last edited by Cutter; 08-01-2012 at 07:15 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1