LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Casey
 
Posts: n/a
Default Run Time error 91


--------------------------------------------------------------------------------

Hi,
I have a little matrix 5R x 6C. Located on a sheet in Cells E23:J27.
All cells within the matrix have data validation in them to restrict
the input to "1" or "0". It is OK to have mutiple selections of "1's"
in the same row, except if the user happen to select a "1" for the
sixth or last cell in the row. If that happens I would like the other
five cells in that row to have a value of "0". A couple of weeks ago
Gary's Student gave me some starter Code that I have been trying to
make into a Worksheet_Change procedure, but no luck.
My Data looks something like:

E F G H I J
23 1 0 0 1 1 0 ok
24 1 0 1 0 0 1 Not ok
25 0 0 0 0 0 1 ok
26 0 0 0 1 1 1 Not ok
27 1 1 1 1 1 0 ok

When the code executes I get the following error

Run time error '91'
Object variable or with block varible not set.

Here is the Code

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim N As Integer
Dim Cells As Range
Dim wks1 As Worksheet

Set wks1 = Worksheets("SET UP SHT(1)")

If Not Intersect(Target, Range("E23:J27")) Is Nothing Then

For i = 23 To 27
N = wks1.Cells(i, 10).Value
If N = 1 Then
Cells(i, 5) = 0
Cells(i, 6) = 0
Cells(i, 7) = 0
Cells(i, 8) = 0
Cells(i, 9) = 0
End If
Next i


End If
End Sub

Thanks for any help


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=472109

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time and motion chart deant Charts and Charting in Excel 0 September 21st 05 08:22 AM
Excel Time Manipulation BFiedler Excel Discussion (Misc queries) 0 September 15th 05 01:15 AM
conditional formatting with time values Access Idiot Excel Discussion (Misc queries) 2 September 13th 05 03:29 PM
Time Sheets smiller3128 New Users to Excel 1 August 4th 05 08:17 PM
unmet challenge boris Excel Worksheet Functions 2 March 16th 05 02:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"