![]() |
Delete a Column Based on User Entry
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 |
Delete a Column Based on User Entry
have a look in vba help for
INPUTBOX FIND -- Don Guillett SalesAid Software "Anice" wrote in message ... 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 |
Delete a Column Based on User Entry
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 |
Delete a Column Based on User Entry
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 |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com