x404.co.uk
http://www.x404.co.uk/forum/

Excel co-ordinate problem
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=19889
Page 1 of 1

Author:  big_D [ Fri Aug 23, 2013 10:42 am ]
Post subject:  Excel co-ordinate problem

I'm having problem with the ActiveCell object in Excel. In the heading, I'm using -2 to go left 3 cells and -1 to go left 1 cell, then in the body I'm using -1 to go left 1 cell... The same with the row number it is 1 to few in the header.

Code:
 
    nRow = 1
    For Each cDep In cDepartments
        ActiveCell(nRow, -2).Value = cDep.departmentName
        nRow = nRow + 1
        For Each cEmp In cDep.Employees
            ActiveCell(nRow, -1).Value = cEmp.employeeName
            nRow = nRow - 1 'FUDGE!
            For Each cActivity In cEmp.Activities
                nRow = nRow + 1
                ActiveCell.Offset(nRow, -1).Value = cActvitiy.plannedDays
            Next cActivity
            nRow = nRow + 1
        Next cEmp
    Next cDep


Nevermind. It is amazing, you look at a problem for hours and then, when you try and explain it to somebody, you spot the problem!

I forgot the ".Offset" in the heading (Department and Employee), but it is there in the Activity part!

Author:  AlunD [ Fri Aug 23, 2013 1:41 pm ]
Post subject:  Re: Excel co-ordinate problem

big_D wrote:
Nevermind. It is amazing, you look at a problem for hours and then, when you try and explain it to somebody, you spot the problem!

I wish I could say that's never happened to me :oops: :D

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/