Re: Help with OFFSET Problem Please

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jim Cone (jim.coneXXX_at_rcn.comXXX)
Date: 02/26/05


Date: Sat, 26 Feb 2005 08:38:30 -0800

Paul,

Move the ActiveCell.Select statement to the bottom and
change all the "-1" values to 0. The following appeared
to work for me...
'----------------------------
Sub TestAgain()
Dim nMaxF As Long
nMaxF = 10
Dim i As Long
Dim j As Long
Dim nCount As Long

For i = 1 To nMaxF - 1
    For j = i + 1 To nMaxF
        nCount = nCount + 1
        If nCount = 65001 Then
            nCount = 1
            ActiveCell.Offset(-65000, 5).Select
        End If
        ActiveCell.Value = i
        ActiveCell.Offset(0, 1).Value = j
        ActiveCell.Offset(0, 2).Value = nNoB(i, j)
        ActiveCell.Offset(0, 3).Value = nB(i, j)
        ActiveCell.Offset(1, 0).Select
    Next j
Next i
End Sub
'---------------------------------
Regards,
Jim Cone
San Francisco, USA

 
"Paul Black" <Anonymous@Discussions.Microsoft.com> wrote in
message news:eTBBFiBHFHA.3332@TK2MSFTNGP15.phx.gbl...
> Not to Worry, I have Managed to Sort it Out.
> One Question though, How can I get it to Start the Output in "A1"
> WITHOUT Using a Minus in the Offset Please.
> Snippet of Code Used for the Offset.
> For i = 1 To nMaxF - 1
> For j = i + 1 To nMaxF
> nCount = nCount + 1
> If nCount = 65001 Then
> nCount = 1
> ActiveCell.Offset(-65000, 5).Select
> End If
> ActiveCell.Offset(1, 0).Select
> ActiveCell.Offset(-1, 0).Value = i
> ActiveCell.Offset(-1, 1).Value = j
> ActiveCell.Offset(-1, 2).Value = nNoB(i, j)
> ActiveCell.Offset(-1, 3).Value = nB(i, j)
> Next j
> Next i
> If I Don't Use the Minus it Starts the Output from Cell "A2".
> Thanks in Advance.
> All the Best.
> Paul



Relevant Pages