Please let me know how I can pass a variable from my double click code to my user form code.
Here's what I have done and it does not work...
In Sheet1--
Public TestTarget As Integer
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim FileToOpen As String
Dim RtnCd As Integer, ResetCd As Integer
Dim ContinueFlag As Integer
Dim LastFile As String
Dim LastDate As Date
Dim Filterby As Integer
'----------------------------------------------
' Total Incidents Selected
'----------------------------------------------
Select Case Target.Column
Case Is = 1
Select Case Target.Row
Case Is = 2
TestTarget = 1
Application.ScreenUpdating = False
UserForm2.Show
End Select
End Select
End Sub
In UserForm2 --
Public TestTarget As Integer
'OK Button Pressed
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
If SortColumn = "" Then
SortColumn = "B1"
Exit Sub
End If
Call ResetCurrentReport("Report", ResetCd)
Call CreateCurrentReport("Report")
ResetCd = 1
Call ResetCurrentReport("Report", ResetCd)
Call BuildSortReport("Report")
LR = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
If SortDirection = 1 Then
Range("A1:H" & LR).CurrentRegion.Sort Key1:=Range(SortColumn), Order1:=xlDescending, Header:=xlYes
Else
Range("A1:H" & LR).CurrentRegion.Sort Key1:=Range(SortColumn), Order1:=xlAscending, Header:=xlYes
End If
Unload Me
Call UnBuildSortReport("Report")
Call FormatReport("Report")
SortColumn = ""
Sheets("Report").Activate
Application.Goto Range("A1"), True
Sheets("Summary").Activate
Cells(1, 1).Select
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Initialize()
End Sub
Once I know how to pass a variable to userform2, I will then write code to support the variable being passed.
Thanks.
Here's what I have done and it does not work...
In Sheet1--
Public TestTarget As Integer
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim FileToOpen As String
Dim RtnCd As Integer, ResetCd As Integer
Dim ContinueFlag As Integer
Dim LastFile As String
Dim LastDate As Date
Dim Filterby As Integer
'----------------------------------------------
' Total Incidents Selected
'----------------------------------------------
Select Case Target.Column
Case Is = 1
Select Case Target.Row
Case Is = 2
TestTarget = 1
Application.ScreenUpdating = False
UserForm2.Show
End Select
End Select
End Sub
In UserForm2 --
Public TestTarget As Integer
'OK Button Pressed
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
If SortColumn = "" Then
SortColumn = "B1"
Exit Sub
End If
Call ResetCurrentReport("Report", ResetCd)
Call CreateCurrentReport("Report")
ResetCd = 1
Call ResetCurrentReport("Report", ResetCd)
Call BuildSortReport("Report")
LR = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
If SortDirection = 1 Then
Range("A1:H" & LR).CurrentRegion.Sort Key1:=Range(SortColumn), Order1:=xlDescending, Header:=xlYes
Else
Range("A1:H" & LR).CurrentRegion.Sort Key1:=Range(SortColumn), Order1:=xlAscending, Header:=xlYes
End If
Unload Me
Call UnBuildSortReport("Report")
Call FormatReport("Report")
SortColumn = ""
Sheets("Report").Activate
Application.Goto Range("A1"), True
Sheets("Summary").Activate
Cells(1, 1).Select
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Initialize()
End Sub
Once I know how to pass a variable to userform2, I will then write code to support the variable being passed.
Thanks.