Hoi,
Onderstaande controleert volgens mij of kolom 5 is ingevuld en C3 niet leeg is?.
in deze regel:
Is de kolom 5 uit te sluiten van die controle?
Onderstaande controleert volgens mij of kolom 5 is ingevuld en C3 niet leeg is?.
in deze regel:
Code:
If lastRowMin >= startRow And Not IsEmpty(wsIn.Range("C3").Value) Then
Is de kolom 5 uit te sluiten van die controle?
Code:
Sub GenerateOutput()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
'Declaring variables
Dim wsIn As Worksheet
Dim wsOut As Worksheet
Dim startRow As Long
Dim checkRange As Range
Set wsIn = Sheets("Invoer")
Set wsOut = Sheets("Export")
'Emptying sheet
ThisWorkbook.Unprotect "BlaBla"
wsIn.Unprotect Password:="BlaBla"
wsOut.Visible = True
For Each Sheet In ActiveWorkbook.Worksheets
If Sheet.Name = "Export" Then
wsOut.Cells.Clear
End If
Next Sheet
'Defining range of relevant cells
startRow = 10
lastRow1 = wsIn.Cells(Rows.Count, 1).End(xlUp).row
lastRow2 = wsIn.Cells(Rows.Count, 2).End(xlUp).row
lastRow3 = wsIn.Cells(Rows.Count, 3).End(xlUp).row
lastRow4 = wsIn.Cells(Rows.Count, 4).End(xlUp).row
lastRow5 = wsIn.Cells(Rows.Count, 5).End(xlUp).row
lastRow6 = wsIn.Cells(Rows.Count, 6).End(xlUp).row
lastRowMin = WorksheetFunction.Min(lastRow1, lastRow2, lastRow3, lastRow4, lastRow6)
lastRowMax = WorksheetFunction.Max(lastRow1, lastRow2, lastRow3, lastRow4, lastRow6)
Set checkRange = wsIn.Range(wsIn.Cells(startRow, 1), wsIn.Cells(lastRowMax, 6))
'Check for empty cells in range
i = 0
For Each checkCell In checkRange
c = c + 1
If IsEmpty(checkCell) Then
i = i + 1
End If
Next checkCell
'Validations if all cells are filled
If Not IsEmpty(wsIn.Range("C3").Value) Then
If lastRowMin >= startRow And Not IsEmpty(wsIn.Range("C3").Value) Then
If i = 0 Then
