PC Review


Reply
Thread Tools Rate Thread

Code seems limited by row number

 
 
Patrick C. Simonds
Guest
Posts: n/a
 
      25th Mar 2008
Can any one explain to me why this code will not run on any row beyond row
99?

I get the following error msg: "activecell row out of range or no list row
selected"

It works perfectly on row's 1 - 99.


Private Sub CommandButton1_Click()

Dim i As Long, nRow As Long, nLstIdx As Long
Dim rngList As Range
Dim aCols, aLstCols

Application.ScreenUpdating = False

aCols = Array(4, 5, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18) '=
destination column number
aLstCols = Array(0, 4, 5, 13, 1, 6, 7, 14, 2, 8, 9, 15) ' = source
column number

Set rngList = Range(Me.ListBox1.RowSource)
nRow = ActiveCell.Row
nLstIdx = Me.ListBox1.ListIndex

If nRow > Me.ListBox1.ListCount Or nLstIdx = -1 Then
MsgBox "activecell row out of range or no list row selected"
Exit Sub
End If

For i = 0 To UBound(aCols)
With Cells(nRow, aCols(i))
.Value = ListBox1.List(nLstIdx, aLstCols(i))
.Font.ColorIndex = rngList(nLstIdx + 1, aLstCols(i) +
1).Font.ColorIndex
End With
Next

Application.ScreenUpdating = True

Unload Tuesday_Route_To_Cover

End Sub

 
Reply With Quote
 
 
 
 
Jarek Kujawa
Guest
Posts: n/a
 
      25th Mar 2008
to me the code works till the row of an active cell is not bigger than
the count of list elements
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limited number of columns Pavel Microsoft Outlook Calendar 0 8th Jul 2008 05:34 PM
limited number of db in a project? =?Utf-8?B?c2llcnJhbGlnaHRmb290?= Microsoft Access Queries 9 16th Feb 2006 04:41 AM
Limited number of Rules =?Utf-8?B?QW5keUM=?= Microsoft Outlook Discussion 3 12th Apr 2004 04:53 PM
limited number of worksheets? Cade Microsoft Excel Misc 2 5th Nov 2003 06:03 PM
limited number of users shiba Microsoft Powerpoint 4 16th Oct 2003 03:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:22 AM.