+ Reply to Thread
Results 1 to 2 of 2

Move to the cell to the right

  1. #1
    macro_guy34345
    Guest

    Move to the cell to the right

    I am having a lot of trouble with this section of my code. My loop inserts
    names on to a grid, but after the row height gets to 350, I want it to start
    putting the names in the cell immediatly to the right.
    This is what I have right now:

    'If the current employee has both the current Results
    'and Capability value then add them to that cell in the
    grid
    If saEmployee(2, lRecordNum) = vResults(lResCounter) _
    And saEmployee(3, lRecordNum) = vCapability(lCapCounter)
    Then

    'Determine which cell in the grid the employee
    belongs to
    Set rngCell = rngGrid.Cells(1 +
    lResCounter, 1 + lCapCounter)
    With rngCell
    If .RowHeight > 350 Then
    .Offset(0, 1) = .Value & Chr(10) &
    saEmployee(1, lRecordNum)
    Else
    .Value = .Value & Chr(10) & saEmployee(1,
    lRecordNum)
    End If
    End With
    End If


    Once column "A" fills up, the macro is supposed to start pasting the
    remaining names in Column "B".

    However, it is appending the entire contents of the original cell in column
    A, into Column B, and then only the current name in the array.

  2. #2
    sebastienm
    Guest

    RE: Move to the cell to the right

    Hi,
    Replace the first 2 rows of the IF by
    If .RowHeight > 350 Then
    .Offset(0, 1) = .Offset(0,1).Value & Chr(10) & saEmployee(1,
    lRecordNum)
    --> added Offset on the right side of the '='
    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "macro_guy34345" wrote:

    > I am having a lot of trouble with this section of my code. My loop inserts
    > names on to a grid, but after the row height gets to 350, I want it to start
    > putting the names in the cell immediatly to the right.
    > This is what I have right now:
    >
    > 'If the current employee has both the current Results
    > 'and Capability value then add them to that cell in the
    > grid
    > If saEmployee(2, lRecordNum) = vResults(lResCounter) _
    > And saEmployee(3, lRecordNum) = vCapability(lCapCounter)
    > Then
    >
    > 'Determine which cell in the grid the employee
    > belongs to
    > Set rngCell = rngGrid.Cells(1 +
    > lResCounter, 1 + lCapCounter)
    > With rngCell
    > If .RowHeight > 350 Then
    > .Offset(0, 1) = .Value & Chr(10) &
    > saEmployee(1, lRecordNum)
    > Else
    > .Value = .Value & Chr(10) & saEmployee(1,
    > lRecordNum)
    > End If
    > End With
    > End If
    >
    >
    > Once column "A" fills up, the macro is supposed to start pasting the
    > remaining names in Column "B".
    >
    > However, it is appending the entire contents of the original cell in column
    > A, into Column B, and then only the current name in the array.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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