Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wonder why the frRptDate and the toRptDate variables never show the values
in the message box? This macro is an option button on a form. I have defined these variables as public variables in a previous module that calls the form and I did a debug. print statement to see that the variables are getting set with the value. Just when the user clicks the form I would like a msgbox with the date of the report so the scope of the variables should be for the entire project right? Correct me if I am wrong. -----Form macro that has msg box with dates-------- Sub optCkforDupes_Click() Dim nResult As Long Debug.Print frRptDate Debug.Print toRptDate Fprocess1 = False If optCkforDupes.Value = True Then nResult = MsgBox(prompt:="From: " & frRptDate & vbNewLine & "To: " & toRptDate, Buttons:=bvOKCancel, Title:="report Date") End If If nResult = vbOK Then Call createXLdb.CkforDupes Fprocess1 = True End If End Sub Its always cell A1 & B1 that has the dates. They have to be removed since it is a database spreadsheet. ----------the module that calls the form------ Option Explicit Public FrReptDate As Date Public ToReptDate As Date -- Public Sub LoadProcessChoices() On Error GoTo ERR_Message openFile deleteDateRow1 ProcessChoices.Show End Sub ------ Private Sub openFile() Const fName As String = "Book1.xls" Const fPath As String = "Mac OS X:SSP Process:" Dim wkb As Workbook On Error Resume Next Set wkb = Workbooks(fName) On Error GoTo 0 If wkb Is Nothing Then _ Set wkb = Workbooks.Open(Filename:=fPath & fName) End Sub ----- Sub deleteDateRow1() Dim Rng As Range Set Rng = Range("A1") With Rng If IsDate(.Value) Then FrReptDate = .Value ToReptDate = .Offset(0, 1).Value ..EntireRow.Delete Shift:=xlUp Debug.Print FrReptDate Debug.Print ToReptDate Else Exit Sub End If End With End Sub THANKS, |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Scope of Variables | Excel Discussion (Misc queries) | |||
Public variables and scope | Excel Programming | |||
Scope of variables | Excel Programming | |||
Scope of a public variable | Excel Programming | |||
Scope of Public Variable | Excel Programming |