I need to have a Macro that prompts the user for a year to delete. The
program would then search the worksheet for that year and delete all data in
that column.
Any suggestions would be great!! Thanks
have a look in vba help for
INPUTBOX
FIND
--
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
"Anice" <Anice@discussions.microsoft.com> wrote in message
news:E24106B2-7B48-4702-99F2-F15AF00AE678@microsoft.com...
>I need to have a Macro that prompts the user for a year to delete. The
> program would then search the worksheet for that year and delete all data
> in
> that column.
>
> Any suggestions would be great!! Thanks
Dim yr as Variant, rng as Range
yr = Application.InputBox("Enter a year ex: 2004",type:=1)
if yr = False then exit sub
set rng = Rows(1).find(yr)
if not rng is nothing then
rng.EntireColumn.Delete
end if
--
Regards,
Tom Ogilvy
"Anice" wrote:
> I need to have a Macro that prompts the user for a year to delete. The
> program would then search the worksheet for that year and delete all data in
> that column.
>
> Any suggestions would be great!! Thanks
Thank you very much. That worked beautifully!
"Tom Ogilvy" wrote:
> Dim yr as Variant, rng as Range
> yr = Application.InputBox("Enter a year ex: 2004",type:=1)
> if yr = False then exit sub
> set rng = Rows(1).find(yr)
> if not rng is nothing then
> rng.EntireColumn.Delete
> end if
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Anice" wrote:
>
> > I need to have a Macro that prompts the user for a year to delete. The
> > program would then search the worksheet for that year and delete all data in
> > that column.
> >
> > Any suggestions would be great!! Thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks