Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel & VBA Macro Help AGAIN

I am in trouble. I have an Excel Worksheet containing a Column A whic
has an entry list of dates. From January 01 to onwards There are
other columns containing different values. The total worksheet is fro
Column A1 to Column F20. My requirement is to Create a Macro by which
will ask user to give a range on the basis of Column A (Column
contains Date Values) by an input dialog box that should ask user t
input starting date and ending date. Once the input values are entere
the program should get the addresses from the input dates. for exampl
if the dates which were enter were in cell A2 and A56 then the progra
should highlight columns from A2 to F2 and A56 to F56 and(A2:A56) bu
these addresse are not constant as they depend upon user input. So
need a macro that could create a range out of that address and mark i
with some border or color or pattern. Please help me and tell me ho
can we achieve this. Please do leave your email address for sayin
thanks.

Darn

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel & VBA Macro Help AGAIN

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:A365"),0)
res1 = Application.Match(clng(sEnd),Range("A1:A365"),0)
if not iserror(res) and not iserror(res1) then
set rng = Range(Range("A1:A20")(res),Range("A1:A365")(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 onwards 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 should get the addresses from the input dates. for example
if the dates which were enter were in cell A2 and A56 then the program
should highlight columns from A2 to F2 and A56 to F56 and(A2:A56) but
these addresse are not constant as they depend upon user input. So i
need a macro that could create a range out of that address and mark it
with some border or color or pattern. Please help me and tell me how
can we achieve this. Please do leave your email address for saying
thanks.

Darno


---
Message posted from http://www.ExcelForum.com/



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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
passing variables from an excel macro to a powerpoint macro jake Excel Programming 1 December 11th 03 02:36 AM


All times are GMT +1. The time now is 11:12 AM.

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

About Us

"It's about Microsoft Excel"