ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro Prompting (https://www.excelbanter.com/excel-programming/412514-excel-macro-prompting.html)

crusse04

Excel Macro Prompting
 
I created an Excel macro to update a worksheet on a monthly basis. The macro
prompts for the Start and Stop dates using the InputBox Method. The problem
I'm having is that the date values will not occupy the designated cells. The
following is what I created:

Dim dtestart As Date
dtestart = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b6").Formula = "dtestart"

Dim dtestop As Date
dtestop = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b7").Formula = "dtestop"

Instead of the dates being input into cells b6 and b7, the strings
"dtestart" and "dtestop" are entered.

Please help! The date (example: 05/31/2008 ) needs to occupy the cell
after it is input.


Harald Staff[_2_]

Excel Macro Prompting
 
Remove the quotes around the variable names
..Formula = dtestart

HTH. Best wishes Harald

"crusse04" wrote in message
...
I created an Excel macro to update a worksheet on a monthly basis. The
macro
prompts for the Start and Stop dates using the InputBox Method. The
problem
I'm having is that the date values will not occupy the designated cells.
The
following is what I created:

Dim dtestart As Date
dtestart = InputBox("ENTER START DATE FOR THIS CDRL PERIOD:
MM/DD/YYYY")
Worksheets("Configuration").Range("b6").Formula = "dtestart"

Dim dtestop As Date
dtestop = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b7").Formula = "dtestop"

Instead of the dates being input into cells b6 and b7, the strings
"dtestart" and "dtestop" are entered.

Please help! The date (example: 05/31/2008 ) needs to occupy the cell
after it is input.



Jim Thomlinson

Excel Macro Prompting
 
Remove the quotes...

Dim dtestart As Date
dtestart = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b6").Formula = dtestart

Dim dtestop As Date
dtestop = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b7").Formula = dtestop

--
HTH...

Jim Thomlinson


"crusse04" wrote:

I created an Excel macro to update a worksheet on a monthly basis. The macro
prompts for the Start and Stop dates using the InputBox Method. The problem
I'm having is that the date values will not occupy the designated cells. The
following is what I created:

Dim dtestart As Date
dtestart = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b6").Formula = "dtestart"

Dim dtestop As Date
dtestop = InputBox("ENTER START DATE FOR THIS CDRL PERIOD: MM/DD/YYYY")
Worksheets("Configuration").Range("b7").Formula = "dtestop"

Instead of the dates being input into cells b6 and b7, the strings
"dtestart" and "dtestop" are entered.

Please help! The date (example: 05/31/2008 ) needs to occupy the cell
after it is input.



All times are GMT +1. The time now is 07:05 AM.

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