Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Referring Date in VBA
If c.Value <= #7/8/2004# Then
c.Value = #7/1/2004# End If but in this code i want to refer month as variable. i will accept th month from user using inputbox. how can i use variable for month in this code. ?????? -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Referring Date in VBA
Dim res as String, lMon as Long
Dim dt as Date, dt1 as Date res = InputBox("Enter Month as a number from 1 to 12) if res = "" then exit sub if isnumeric(res) then lMon = clng(res) if lMon = 1 and lMon <= 12 then set dt = DateSerial(2004,lMon,8) set dt1= DateSerial(2004,lMon,1) if c.Value <= dt then c.Value = dt1 End if end if Else msgbox "Invalid entry" End if -- Regards, Tom Ogilvy "anupam " wrote in message ... If c.Value <= #7/8/2004# Then c.Value = #7/1/2004# End If but in this code i want to refer month as variable. i will accept the month from user using inputbox. how can i use variable for month in this code. ??????? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referring a cell | Excel Discussion (Misc queries) | |||
putting date in a cell referring to the tab sheet | Excel Discussion (Misc queries) | |||
Totalling by referring to 2 date ranges | Excel Discussion (Misc queries) | |||
Totalling by referring to 2 date ranges | Excel Discussion (Misc queries) | |||
referring to other worksheet | Excel Worksheet Functions |