UserForm_Initialize not processing as expecteded, etc

Apologies I’ve I’ve not posted this correctly. I don’t know how to put my vba coding into its own window.
I’ve been relearning to use excel and vba try to automate an excel monthly meal plan for a seniors’ home in which I live. After several months, I’ve accomplished a lot. That said, I’ve been exploring how I might optimize my coding, reduce redundant variable, and restructure the file by expanding the versatility of some subs. To that end, I’ve integrated Debug.Print to help. What an eye-opener!!!!
Just within my first few subs I saw things happening I needed to understand to better design my subs and functions. In truth, I have yet to apply functions, but their structure seems to be more complicated for my aging brain. Two important things at this point I hope can be explained as they could vastly improve the entire structure of my file. I’ve embedded comments in my coding to try to limit the length of my question and provide context

Further context (You might have to review my code and debug printout below. It’s not going well for me trying to post this): A sub uses LdRow (stored in txtcRow) to populate formMealPlan. Pretty much whatever subs follow Build_ddnUnitNo() need the value placed into txtcRow.

Questions:

  1. Before cleaning everything up for the sake of preparing this for your guidance, the debug.print yielded something along the lines of Build_ddnUnitNo(D112) where those sub were just …. Sub Subname() …. That being the case, how might I better take advantage of what was/is going on here?
  2. Should a global variable set in Worksheet coding not work for the entire project? (I hope I’m using the correct terminology to be understood.)
  3. I’ve tried turning a sub into a function but run into problems in knowing just how to set up the variable when their options are so vast. And while I’m pretty adept at resolving whatever my issues are, but this one, for all its efficiencies, could be just to time consuming than just creating the workarounds. At least for me.
    Thank you for your time and patience.

` Option Explicit ”” Worksheet Code
Public WksFlag As Boolean
Public WksRow As Integer, LdRow As Integer

    Sub Worksheet_BeforeDoubleClick(ByVal WksUn As Range, WksFlag As Boolean)
        Subroutine = "SUB: Wks_B4DblClick"
        Debug.Print "---> Start " & Subroutine & "(" & WksUn & ", " & WksFlag & ")"

        If WksUn.Column = 1 Then            'WksUn for Worksheet UnitNo (D112)
            WksRow = WksUn.Row                  'These dims should be global/public 
            LdRow = WksRow – 4                  'LdRow for ListDiners in User Form
            formMealPlan.txtcRow.Value = LdRow
            Load frmMealPlan
        frmMealPlan.Show (vbModeless)
        End If      '''' WksRow, LdRow, WksUn don’t seem to immediately Public
        '''' Even if I also declare them as well in formMealPlan. (See included printout) 
    Debug.Print vbNewLine & "<--- End " & Subroutine & "(" & WksUn & ", " & WksFlag & ")"
    End Sub

    '''' formMealPlan (userform) Code
    Public LdRow As Integer, WksRow As Integer

    Sub UserForm_Initialize()
        Subroutine = "SUB: UserForm_Initialize"
        Debug.Print "---> Start " & Subroutine & "()"

        Debug.Print "txtcRow(" & txtcRow & ")"    <<<< This is here to display my point

        Exit Sub            '''' I'll move this below Build_ddnUnitNo for 2nd run
    
    Build_ddnUnitNo                 '''''Populates the Unit Number drop down list

    End Sub



'''''''''' The Debug . Printout ''''''''''


        1st  Debug.Print  run
 ---> Start SUB: Wks_B4DblClick(D112, False)
 ---> Start SUB: UserForm_Initialize()
 txtcRow()
 ---> Start Sub: txtcRow_Change()
 <--- End Sub: txtcRow_Change()      <<< This appears Build_ddnUnitNo sub (see below)
 <--- End SUB: Wks_B4DblClick(D112, False)

          2nd  Debug.Print  run 
 ---> Start SUB: Wks_B4DblClick(D112, False)
 ---> Start SUB: UserForm_Initialize()
 txtcRow()      <<< If this weren’t blank, I could use it immediately rather than 
    <<< have to force set it.
 ---> Start SUB: Build_ddnUnitNo()
 <--- End SUB: Build_ddnUnitNo()
 ---> Start SUB: txtcRow_Change ()
 <--- End Sub: txtcRow_Change()      <<< I can’t seem to move this up.

`

New contributor

Bernie Slepkov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật