Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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

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
How 2 lock row and column delete/add but allow data entry? CC Santa Monica Excel Discussion (Misc queries) 8 January 29th 19 02:51 AM
Automating to autofill column B based on column A entry GirlFridayCA Excel Discussion (Misc queries) 2 December 2nd 08 10:46 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
Delete Entry Based on Selection AntnyMI Excel Discussion (Misc queries) 1 September 16th 06 06:24 PM
Filter Excel Pivot, based on user entry form Jayco Excel Discussion (Misc queries) 1 August 16th 06 06:07 PM


All times are GMT +1. The time now is 04:15 PM.

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"