Results 1 to 11 of 11

Excel - VBA : pass variable from Sub to Userform (Date Picker)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Excel - VBA : pass variable from Sub to Userform (Date Picker)

    I want to pass a variable from a sub of my Module1 to a userform. Right now the value is put into the active sheet. The sub is called when the user clicks a textbox (the very textbox I would like to return the value after running the sub). Is this possible? Just curious.
    Sub AdvancedCalendar()
        dateVariable = CalendarForm.GetDate( _
            SelectedDate:=Range("H34").value, _    '//looking to change the destination to Textbox1 of my Userform1
            FirstDayOfWeek:=Monday, _
            DateFontSize:=12, _
            TodayButton:=True, _
            OkayButton:=True, _
            ShowWeekNumbers:=True, _
            BackgroundColor:=RGB(243, 249, 251), _
            HeaderColor:=RGB(147, 205, 2221), _
            HeaderFontColor:=RGB(255, 255, 255), _
            SubHeaderColor:=RGB(223, 240, 245), _
            SubHeaderFontColor:=RGB(31, 78, 120), _
            DateColor:=RGB(243, 249, 251), _
            DateFontColor:=RGB(31, 78, 120), _
            TrailingMonthFontColor:=RGB(155, 194, 230), _
            DateHoverColor:=RGB(223, 240, 245), _
            DateSelectedColor:=RGB(202, 223, 242), _
            SaturdayFontColor:=RGB(0, 176, 240), _
            SundayFontColor:=RGB(0, 176, 240), _
            TodayFontColor:=RGB(0, 176, 80))
        If dateVariable <> 0 Then Range("H34") = dateVariable
    End Sub
    Last edited by terriertrip; 09-26-2017 at 09:17 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Update record - how to pass variable from one userform module to another
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2015, 09:49 AM
  2. Replies: 3
    Last Post: 05-15-2015, 07:27 PM
  3. How to pass a variable value from a Userform listbox/spinbutton to another sub
    By max3732 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2014, 01:01 PM
  4. Can't pass a variable value from a worksheet sub to a userform sub
    By Dan Vollmer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2014, 10:24 AM
  5. Pass Variable From UserForm to Module
    By BLLMRC in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-24-2013, 12:41 PM
  6. [SOLVED] Pass variable from module to userform and back
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2006, 11:50 AM
  7. [SOLVED] Pass public variable from one userform to a second...
    By Mike Dunworth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2005, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1