Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default date drop down box in vba

Hello,
I am new to vba for excel. Ive tried finding the solution in many books but
was unable.
I need to create date drop down box that will defualt to the current day,
but give the user the option to select another day up to at least 32 days
before the current day. I also need the selected day to appear in seveal
cells in the workbook. And if it is possible to show the day of week next to
the selected date.
Format mm/dd/yyyy

Thank for your Help

Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default date drop down box in vba

Here is some code

Sub Jim()
With Range("D1:D12").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="=$M$1:$M$33"
End With
Range("M1").Formula = "=TODAY()"
Range("M2").Formula = "=M1-1"
Range("M2").AutoFill Destination:=Range("M2:M33"), Type:=xlFillDefault
Range("M1:M33").NumberFormat = "ddd dd mmm yyyy"
Columns("D:D").ColumnWidth = 16
Columns("M:M").ColumnWidth = 16
Range("D1:D12") = Date
Range("D1:d12").NumberFormat = "ddd dd mmm yyyy"
Range("D1").Select
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fuzzy31" wrote in message
...
Hello,
I am new to vba for excel. Ive tried finding the solution in many books

but
was unable.
I need to create date drop down box that will defualt to the current day,
but give the user the option to select another day up to at least 32 days
before the current day. I also need the selected day to appear in seveal
cells in the workbook. And if it is possible to show the day of week next

to
the selected date.
Format mm/dd/yyyy

Thank for your Help

Jim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default date drop down box in vba

Hi Bob
thanks for writing back.
I'm having trouble with this line
..Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
I'm getting a compile error: syntax error
any help would be great
"Bob Phillips" wrote:

Here is some code

Sub Jim()
With Range("D1:D12").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="=$M$1:$M$33"
End With
Range("M1").Formula = "=TODAY()"
Range("M2").Formula = "=M1-1"
Range("M2").AutoFill Destination:=Range("M2:M33"), Type:=xlFillDefault
Range("M1:M33").NumberFormat = "ddd dd mmm yyyy"
Columns("D:D").ColumnWidth = 16
Columns("M:M").ColumnWidth = 16
Range("D1:D12") = Date
Range("D1:d12").NumberFormat = "ddd dd mmm yyyy"
Range("D1").Select
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fuzzy31" wrote in message
...
Hello,
I am new to vba for excel. Ive tried finding the solution in many books

but
was unable.
I need to create date drop down box that will defualt to the current day,
but give the user the option to select another day up to at least 32 days
before the current day. I also need the selected day to appear in seveal
cells in the workbook. And if it is possible to show the day of week next

to
the selected date.
Format mm/dd/yyyy

Thank for your Help

Jim




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default date drop down box in vba

Thanks for your help Bob, I figured out what I did wrong with your code. It
was late & I wasn't thinking

"Bob Phillips" wrote:

Here is some code

Sub Jim()
With Range("D1:D12").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="=$M$1:$M$33"
End With
Range("M1").Formula = "=TODAY()"
Range("M2").Formula = "=M1-1"
Range("M2").AutoFill Destination:=Range("M2:M33"), Type:=xlFillDefault
Range("M1:M33").NumberFormat = "ddd dd mmm yyyy"
Columns("D:D").ColumnWidth = 16
Columns("M:M").ColumnWidth = 16
Range("D1:D12") = Date
Range("D1:d12").NumberFormat = "ddd dd mmm yyyy"
Range("D1").Select
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fuzzy31" wrote in message
...
Hello,
I am new to vba for excel. Ive tried finding the solution in many books

but
was unable.
I need to create date drop down box that will defualt to the current day,
but give the user the option to select another day up to at least 32 days
before the current day. I also need the selected day to appear in seveal
cells in the workbook. And if it is possible to show the day of week next

to
the selected date.
Format mm/dd/yyyy

Thank for your Help

Jim




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default date drop down box in vba

The old NG wrap-around I see. I try to account for it, but I get caught
frequently ... grrrr

Bob


"Fuzzy31" wrote in message
...
Thanks for your help Bob, I figured out what I did wrong with your code.

It
was late & I wasn't thinking

"Bob Phillips" wrote:

Here is some code

Sub Jim()
With Range("D1:D12").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,

Operator:=
_
xlBetween, Formula1:="=$M$1:$M$33"
End With
Range("M1").Formula = "=TODAY()"
Range("M2").Formula = "=M1-1"
Range("M2").AutoFill Destination:=Range("M2:M33"),

Type:=xlFillDefault
Range("M1:M33").NumberFormat = "ddd dd mmm yyyy"
Columns("D:D").ColumnWidth = 16
Columns("M:M").ColumnWidth = 16
Range("D1:D12") = Date
Range("D1:d12").NumberFormat = "ddd dd mmm yyyy"
Range("D1").Select
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fuzzy31" wrote in message
...
Hello,
I am new to vba for excel. Ive tried finding the solution in many

books
but
was unable.
I need to create date drop down box that will defualt to the current

day,
but give the user the option to select another day up to at least 32

days
before the current day. I also need the selected day to appear in

seveal
cells in the workbook. And if it is possible to show the day of week

next
to
the selected date.
Format mm/dd/yyyy

Thank for your Help

Jim






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
drop down date kalasha Excel Worksheet Functions 3 September 24th 08 12:24 AM
How do I create a drop down box with the date in it Dustin Excel Worksheet Functions 4 November 12th 07 07:34 PM
Date Drop-down list azlan Setting up and Configuration of Excel 2 July 4th 07 05:51 AM
How to use the drop down date in Excel? gwtreece Excel Worksheet Functions 1 August 4th 06 03:44 PM
Drop AM and PM from date EMG03 Excel Worksheet Functions 1 July 20th 05 11:30 PM


All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"