Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to input 2 dates and mark them as range...
I am in trouble. I have an Excel Worksheet containing a Column A which
has an entry list of dates. From January 01 to January 20. There are 5 other columns containing different values. The total worksheet is from Column A1 to Column F20. My requirement is to Create a Macro by which I will ask user to give a range on the basis of Column A (Column A contains Date Values) by an input dialog box that should ask user to input starting date and ending date. Once the input values are entered the program either should ask to enter starting cell range and ending cell range or it should get the addresses from the input dates. The program code should be able to highlight columns A5:F20 and apply a red border around it or any pattern. Please help me and tell me how can we achieve this. darno --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to input 2 dates and mark them as range...
Dim sStart as String, sEnd as String
Dim res as variant, res1 as variant Dim rng as Range sStart = Inputbox("Enter Start Date") sEnd = InputBox("Enter End Date") If isdate(sStart) and isDate(sEnd) then res = Application.Match(clng(sStart),Range("A1:A20"),0) res1 = Application.Match(clng(sEnd),Range("A1:A20"),0) if not iserror(res) and not iserror(res1) then set rng = Range(Range("A1:A20")(res),Range("A1:A20")(res1)) rng.resize(,6).BordersAround Weight:=xlMedium, ColorIndex:= 3 End if End if would be the basic approach. You can add in code to validate the entries in the inputbox and dress it up and so forth. You might want to clear all borders at the start, but you can get this code with the macro recorder. -- Regards, Tom Ogilvy "darno " wrote in message ... I am in trouble. I have an Excel Worksheet containing a Column A which has an entry list of dates. From January 01 to January 20. There are 5 other columns containing different values. The total worksheet is from Column A1 to Column F20. My requirement is to Create a Macro by which I will ask user to give a range on the basis of Column A (Column A contains Date Values) by an input dialog box that should ask user to input starting date and ending date. Once the input values are entered the program either should ask to enter starting cell range and ending cell range or it should get the addresses from the input dates. The program code should be able to highlight columns A5:F20 and apply a red border around it or any pattern. Please help me and tell me how can we achieve this. darno --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to mark key dates on chart? | Charts and Charting in Excel | |||
Select a range of data dependant on the users input ie dates | Excel Discussion (Misc queries) | |||
How to mark down the time when entering input to a cell? | Excel Worksheet Functions | |||
How to mark down the time when entering input to a cell? | Excel Discussion (Misc queries) | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |