The full code for the macro(s) in question:
Sub realBusiness()
Application.ScreenUpdating = False
generalCabinsOverview
clearPOB
updatePobArr
Application.ScreenUpdating = True
End Sub
Sub updatePobArr()
Dim a, b, c As Integer
Dim cll, xcll, ycll, xrng, yrng As Range
Dim el, et, xarr As Variant
Dim ccabin As String
Dim cabinarr, pobarr, d, f As Variant
'On Error GoTo ending
c = Worksheets("dB").Range("S2")
'Worksheets("CABIN LIST").Range("AG1") = Sheets(c).Range("G2")
Worksheets("CABIN LIST").Range("V1") = Sheets(c).Range("G2")
a = Worksheets("db").Range("C" & Rows.Count).End(xlUp).Row
Set xrng = Worksheets("dB").Range("C3:L" & a)
pobarr = xrng
Set yrng = Worksheets("CABIN LIST").Range("C3:AO81")
cabinarr = yrng
For el = LBound(pobarr) To UBound(pobarr)
If pobarr(el, 10) = "x" Then
ccabin = Replace(pobarr(el, 6), "D", "") & pobarr(el, 7)
For f = 1 To 79 Step 10
For d = 1 To 27 Step 3
If cabinarr(f, d) <> "" Then
If Trim(cabinarr(f, d) & cabinarr(f + 1, d)) = Trim(ccabin) Then
''' double cabins
If pobarr(el, 9) = "D" Then
cabinarr(f + 1, d + 1) = "DAY"
ElseIf pobarr(el, 9) = "N" Then
cabinarr(f + 1, d + 1) = "NIGHT"
End If
If Application.Proper(pobarr(el, 4)) = "Vanquish" Or Application.Proper(pobarr(el, 4)) = "RAG" Or _
Application.Proper(pobarr(el, 4)) = "Slate" Or Application.Proper(pobarr(el, 4)) = "Larimar" Or Application.Proper(pobarr(el, 4)) = "Envier" Then
cabinarr(f + 2, d + 1) = pobarr(el, 5)
Else
cabinarr(f + 2, d + 1) = pobarr(el, 4)
End If
cabinarr(f + 3, d + 1) = pobarr(el, 2)
' ycll.Offset(4, 2) = Worksheets(Worksheets("dB").Range("R2")).Range("G2")
GoTo nextxcll
'Debug.Print Trim(ycll & ycll.Offset(5, 0))
'Debug.Print ccabin & xcll.Offset(0, 1)
ElseIf Trim(cabinarr(f, d) & cabinarr(f + 5, d)) = Trim(ccabin) Then
If pobarr(el, 9) = "D" Then
cabinarr(f + 5, d + 1) = "DAY"
ElseIf pobarr(el, 9) = "N" Then
cabinarr(f + 5, d + 1) = "NIGHT"
End If
If Application.Proper(pobarr(el, 4)) = "Valaris" Or Application.Proper(pobarr(el, 4)) = "Agr" Or _
Application.Proper(pobarr(el, 4)) = "Atlas" Or Application.Proper(pobarr(el, 4)) = "Drillmar" Or Application.Proper(pobarr(el, 4)) = "Entier" Then
cabinarr(f + 6, d + 1) = pobarr(el, 5)
Else
cabinarr(f + 6, d + 1) = pobarr(el, 4)
End If
cabinarr(f + 7, d + 1) = pobarr(el, 2)
' ycll.Offset(4, 2) = Worksheets(Worksheets("dB").Range("R2")).Range("G2")
GoTo nextxcll
End If
End If
Next d
Next f
End If
nextxcll:
Next el
Worksheets("CABIN LIST").Unprotect
yrng = cabinarr
Worksheets("CABIN LIST").Protect
ending:
Erase pobarr
Erase cabinarr
End Sub
Sub clearPOB()
Dim yrng, ycll As Range
On Error Resume Next
Set yrng = Union(Worksheets("CABIN LIST").Range("R3:AM3"), Worksheets("CABIN LIST").Range("C13:F13"), _
Worksheets("CABIN LIST").Range("C23:AD23"), Worksheets("CABIN LIST").Range("C33:U33"), _
Worksheets("CABIN LIST").Range("F43:U43"), Worksheets("CABIN LIST").Range("C53:AM53"), _
Worksheets("CABIN LIST").Range("C63:AM63"), Worksheets("CABIN LIST").Range("C73:AM73"))
For Each ycll In yrng
If ycll <> "" Then
ycll.Offset(1, 1) = ""
ycll.Offset(2, 1) = ""
ycll.Offset(3, 1) = ""
ycll.Offset(4, 0) = ""
ycll.Offset(4, 2) = ""
ycll.Offset(5, 1) = ""
ycll.Offset(6, 1) = ""
ycll.Offset(7, 1) = ""
ycll.Offset(8, 0) = ""
ycll.Offset(8, 2) = ""
GoTo nextycll
End If
nextycll:
Next
End Sub
Sub updatePobDep()
Dim a, b As Integer
Dim xcll, ycll, xrng, yrng As Range
Dim el, xarr As Variant
Dim ccabin As String
Dim crewarr, mdsarr, catarr, winarr, winsarr, pobarr As Variant
On Error GoTo ending
a = Worksheets("db").Range("C" & Rows.Count).End(xlUp).Row
Set xrng = Worksheets("dB").Range("C3:L" & a)
pobarr = xrng
Set yrng = Union(Worksheets("CABIN LIST").Range("S4:AN4"), Worksheets("CABIN LIST").Range("D14:G14"), _
Worksheets("CABIN LIST").Range("D24:AE24"), Worksheets("CABIN LIST").Range("D34:V34"), _
Worksheets("CABIN LIST").Range("G44:V44"), Worksheets("CABIN LIST").Range("D54:AN54"), _
Worksheets("CABIN LIST").Range("D64:AN64"), Worksheets("CABIN LIST").Range("D74:AN74"))
For el = LBound(pobarr) To UBound(pobarr)
If pobarr(el, 10) = "x" Then
ccabin = Replace(pobarr(el, 6), "D", "") & pobarr(el, 7)
For Each ycll In yrng
If ycll <> "" Then
If Trim(ycll & ycll.Offset(1, 0)) = Trim(ccabin) Then
''' double cabins
Application.EnableEvents = False
ycll.Offset(1, 1) = ""
ycll.Offset(2, 1) = ""
ycll.Offset(3, 1) = ""
ycll.Offset(4, 0) = ""
ycll.Offset(4, 2) = ""
Application.EnableEvents = True
GoTo nextxcll
' Debug.Print Trim(ycll & ycll.Offset(5, 0))
' Debug.Print ccabin & xcll.Offset(0, 1)
ElseIf Trim(ycll & ycll.Offset(5, 0)) = Trim(ccabin) Then
Application.EnableEvents = False
ycll.Offset(5, 1) = ""
ycll.Offset(6, 1) = ""
ycll.Offset(7, 1) = ""
ycll.Offset(8, 0) = ""
ycll.Offset(8, 2) = ""
Application.EnableEvents = True
GoTo nextxcll
End If
End If
Next
End If
nextxcll:
Next el
ending:
Erase pobarr
End Sub