ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call up form calendar form VBA (https://www.excelbanter.com/excel-programming/381601-re-call-up-form-calendar-form-vba.html)

Bob Phillips

Call up form calendar form VBA
 
Setup a couple of public variables, and load these variables from within the
form before closing the form down.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Val" wrote in message
...
I have a macro which filters the data based on two dates. Currently, the
dates must be entered in two cells before running the macro. Macro is then
referring to these two cell values. I'm trying to improve and have the

user
promted to enter start and end dates through the frmCalendar, which I

already
created. Is it possible to program this and save these two variables in

VBA
for future use?

I started with

' Start date variable
Public sDate as Date
' End date variable
Public nDate as Date
MsgBox "Enter Start Date"
frm.Calendar.Show

Getting an error so far. Any idea how to make it work? Thank you.

Val





Dave Peterson

Call up form calendar form VBA
 
What's the name of the userform?

frm.calendar isn't a valid name.



Val wrote:

Hi, Bob

I'm getting "Object Required" error on frm.Calendar.Show line

My working macro is in Module 1, sub OpenCalendar() - Module 2. I set up two
public variables sDate and nDate

Sorry if it's a simple question, I'm new to this.

Thanks a lot.
Val

"Bob Phillips" wrote:

Setup a couple of public variables, and load these variables from within the
form before closing the form down.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Val" wrote in message
...
I have a macro which filters the data based on two dates. Currently, the
dates must be entered in two cells before running the macro. Macro is then
referring to these two cell values. I'm trying to improve and have the

user
promted to enter start and end dates through the frmCalendar, which I

already
created. Is it possible to program this and save these two variables in

VBA
for future use?

I started with

' Start date variable
Public sDate as Date
' End date variable
Public nDate as Date
MsgBox "Enter Start Date"
frm.Calendar.Show

Getting an error so far. Any idea how to make it work? Thank you.

Val






--

Dave Peterson

Val

Call up form calendar form VBA
 
Thanks, Dave

It's frmCalendar, I see it now. It opens up finally, but still can't get
those variables to work.

Val


"Dave Peterson" wrote:

What's the name of the userform?

frm.calendar isn't a valid name.



Val wrote:

Hi, Bob

I'm getting "Object Required" error on frm.Calendar.Show line

My working macro is in Module 1, sub OpenCalendar() - Module 2. I set up two
public variables sDate and nDate

Sorry if it's a simple question, I'm new to this.

Thanks a lot.
Val

"Bob Phillips" wrote:

Setup a couple of public variables, and load these variables from within the
form before closing the form down.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Val" wrote in message
...
I have a macro which filters the data based on two dates. Currently, the
dates must be entered in two cells before running the macro. Macro is then
referring to these two cell values. I'm trying to improve and have the
user
promted to enter start and end dates through the frmCalendar, which I
already
created. Is it possible to program this and save these two variables in
VBA
for future use?

I started with

' Start date variable
Public sDate as Date
' End date variable
Public nDate as Date
MsgBox "Enter Start Date"
frm.Calendar.Show

Getting an error so far. Any idea how to make it work? Thank you.

Val






--

Dave Peterson


Dave Peterson

Call up form calendar form VBA
 
There's an _initialize event that you can use to populate your calendar--kind of
like:

Option Explicit
Private Sub UserForm_Initialize()
me.calendar1.value = cdate(sdate)
End Sub




Val wrote:

Thanks, Dave

It's frmCalendar, I see it now. It opens up finally, but still can't get
those variables to work.

Val


"Dave Peterson" wrote:

What's the name of the userform?

frm.calendar isn't a valid name.



Val wrote:

Hi, Bob

I'm getting "Object Required" error on frm.Calendar.Show line

My working macro is in Module 1, sub OpenCalendar() - Module 2. I set up two
public variables sDate and nDate

Sorry if it's a simple question, I'm new to this.

Thanks a lot.
Val

"Bob Phillips" wrote:

Setup a couple of public variables, and load these variables from within the
form before closing the form down.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Val" wrote in message
...
I have a macro which filters the data based on two dates. Currently, the
dates must be entered in two cells before running the macro. Macro is then
referring to these two cell values. I'm trying to improve and have the
user
promted to enter start and end dates through the frmCalendar, which I
already
created. Is it possible to program this and save these two variables in
VBA
for future use?

I started with

' Start date variable
Public sDate as Date
' End date variable
Public nDate as Date
MsgBox "Enter Start Date"
frm.Calendar.Show

Getting an error so far. Any idea how to make it work? Thank you.

Val






--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com