looping

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rancley
    New Member
    • Aug 2007
    • 1

    looping

    Hi Guys,

    I know this is a fairly easy question but the help would be appreciated.
    I have a huge spreadsheet that I have to analyse. I need to consider cases where the rows are equal to the column and return a specific value, so basically returning all the values on the diagonal.

    Regards
    Rancley
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by rancley
    Hi Guys,

    I know this is a fairly easy question but the help would be appreciated.
    I have a huge spreadsheet that I have to analyse. I need to consider cases where the rows are equal to the column and return a specific value, so basically returning all the values on the diagonal.

    Regards
    Rancley
    Explain little bit more about your versions of frontend and backend, detail descreption of your problem with what you had tryed.

    Comment

    • Hassan Darwesh
      New Member
      • Aug 2007
      • 6

      #3
      You can make 2 loops inside each other .. I will give you EX

      Code:
      Dim R As Integer, C As Integer  ' R for row and C for Columns
      
      For R = 1 to row count
      
           For C = 1 to columns count
      
                     If R = C  then do what you want
      
           Next C
      
      Next R
      I hope I help you with that code .. and I hope I didn't misunderstand you
      Last edited by Killer42; Aug 6 '07, 09:49 AM. Reason: Added [CODE] tag

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Actually, I think a single loop will do for this one. Just use the loop counter for both the row and column number.

        Comment

        Working...