Results 1 to 4 of 4

Passing variable value from Private Sub to Module

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    Passing variable value from Private Sub to Module

    I am trying to pass a variable called "Filter" from a Private Sub to a Module but keeping coming up with a zero value in the Module. I tried to make the variable Global but that didn't seem to work. Any suggestions for a solution is appreciated. Thanks.

    Private Sub Code as follows:
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    
    Dim i               As Long
    Dim LastRow         As Long
    Dim Rep             As String
    Dim Color           As Long
    Dim Filter          As Long
        
        Filter = 1
    Global Variables as follows:
    Global SortByColumn As Long
    Global SortOrder As Long
    Global Filter As Long
    Module Code as follows:
    Sub MoodysSort()
    
    Dim i As Long
    Dim lngSortIndex As Long
    Dim EndRow As Long
    
        If Filter = 0 Then
            'do something
        Else
            'do something else
        End If
    Last edited by maacmaac; 08-12-2009 at 08:38 AM.

Thread Information

Users Browsing this Thread

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

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