Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing excel cells !something's wrong!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm writing some vba code in excel, and having major problems.
Hope somebody can help me.

This program is destinated for some sort of company :
it contains 50 worksheets for 50 machines that must be verificated if working allright. By inputting data in the worksheets, and pressing the update button , u should get all the different NOK data in the NOK-worksheet. The problem is the same NOK-data can't be 2 times in the NOK-worksheet.

The problem is situated here :

Public blznummer As Integer
Public machinenummer As Integer
Public activeworksheet As Excel.Worksheet
Public S As Integer
Public R As Integer
Public C As Integer
Public blat As String
Public NAAM As String
Public Differ As Integer


Private Sub Rechthoek1_Bijklikken()
Load UserForm1
Load UserForm2
UserForm1.Show
End Sub

Public Function updateoverzichten()
on error goto errorhandler
With Workbooks("Registraties.xls")
For S = 1 To Worksheets.Count - 4
ShieT = "Blad" & S
For R = 10 To .Worksheets("Save").Cells(9, S + 2).Value + 10
If .Worksheets(ShieT).Cells(R, 1).Value = "NOK" Then
PlaatsFunctie = .Worksheets("Save").Range("C15").Value + 10
DifferFunctieOK = False
For D = 10 To .Worksheets("Save").Range _("C15").Value + 11

'error must be on this line

If .Worksheets(ShieT).Cells(R, 5).Value = .Worksheets
("NOK").Cells(D, 5).Value Then

'
DifferFunctieOK = True
End If
Next D
If DifferFunctieOK = False Then
Differ = 1
Else
Differ = 0
End If
If Differ = 1 Then
For C = 1 To 14
.Worksheets("NOK").Cells(PlaatsFunctie, C).Value = .Worksheets(ShieT).Cells(R, C).Value
Next C
.Worksheets("Save").Range("C15").Value = .Worksheets
("Save").Range("C15").Value + 1
Else
MsgBox "zijn't zelfde " & Differ
End If
End If
Next R
Next S
End With
Exit Function

errorhandler:
MsgBox "Er heeft zich een probleem voorgedaan." & vbNewLine & "Gelieve het programma te beëindigen indien mogelijk.", vbExclamation, "unknown error"
End Function


The full program is downloadable at
Hope somebody can help me
thanks
 
What is the underscore doing in this line?

For D = 10 To .Worksheets("Save").Range _("C15").Value + 11 Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top