Originally Posted by
StOsCZ
If I have them all in one module, I have to scroll through them. this way i can have like 3 modules on one screen and just look for what I need.
Are there any, like, technical problems with this? Processing times and what not?
Is it really better to have them all in one?
Usually personal choice, but it does help to keep things organized.
1. IN ...
Dim dID, dSO, dRO, dSD, dPC, dNP, dMJ, dMN, dJC, dPP, dVV, dTS, dKP, dVA, dSUM As Double
... everything except dSum is a variant since there is no explicit As ...
You probably wanted
Dim dID As Double, dSO As Double .....etc
2. What I usually do is ....
I use some columns for specific data across all modules, so if I need to change the position(number) of the column I don't have to search all the modules and change them manually. I want some "settings" for all the modules.
... put these in 'mod_Global' and ...
Option Explicit
Public Const colDate As Long = 1
Public Const colName As Long = 2
Public Const colTitle As Long = 3
then use in any module
Option Explicit
Sub Four()
Call Add("GHI", "JKL", "Big Boss")
Call Add("MNO", "PQR", "Boss")
Call Add("STU", "VWX", "Worker")
End Sub
Sub Add(FN As String, LN As String, T As String)
Dim s3 As String ' scope = Procedure (not 'module' like I said in the the workbook :-)
Dim r As Range
s3 = LN & ", " & FN
'first blank cell after last cell with data in colA
With ActiveSheet
Set r = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow
End With
With r
.Cells(colDate).Value = Int(Now)
.Cells(colName).Value = s3
.Cells(colTitle).Value = T
End With
End Sub
3. Variable scope and visibility is important so that the most correct is used. The attached WB has some examples if you want to look
Understanding scope and visibility (VBA) | Microsoft Docs