Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Drummy
 
Posts: n/a
Default input box within macro


Join Date: May 2006
Posts: 19

Input box inside a macro

--------------------------------------------------------------------------------

Ok, I need to create a button with a macro attached which allows me to
delete columns within a worksheet,

in this macro I must include an input box which asks the user to
either
identify as 'the treasurer' and delete all 'financial' data

Sheets("Membership").Select
Range("G3:H17,K3:K17").Select
Range("K3").Activate
Selection.ClearContents
End Sub

or identify as 'the registrar' and delete all 'results' data

Sheets("Results").Select
Range("E3:I17").Select
Selection.ClearContents
End Sub

how do I this?, above is two seperate macros I have recorded which I
want to combine with an input box, can anybody give me an example that
I can copy and paste into the macro??


--
Drummy
------------------------------------------------------------------------
Drummy's Profile: http://www.excelforum.com/member.php...o&userid=34780
View this thread: http://www.excelforum.com/showthread...hreadid=549324

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default input box within macro

Do you need passwords, or do you trust them? Either way, I'd suggest a
UserForm rather than an input box, but if you want an input box then
sub ClearData
dim Who as string
who=lcase$(inputbox("Please identify yourself"))
select case who
case "treasurer"
Sheets("Membership").Range("G3:H17,K3:K17").ClearC ontents
case "registrar"
Sheets("Results").Range("E3:I17").ClearContents
case else
msgbox "You have identified yourself as something other than
Registrar or Treasurer!"
end select
end sub

(is it always rows 3-17?)


Drummy wrote:
Join Date: May 2006
Posts: 19

Input box inside a macro

--------------------------------------------------------------------------------

Ok, I need to create a button with a macro attached which allows me to
delete columns within a worksheet,

in this macro I must include an input box which asks the user to
either
identify as 'the treasurer' and delete all 'financial' data

Sheets("Membership").Select
Range("G3:H17,K3:K17").Select
Range("K3").Activate
Selection.ClearContents
End Sub

or identify as 'the registrar' and delete all 'results' data

Sheets("Results").Select
Range("E3:I17").Select
Selection.ClearContents
End Sub

how do I this?, above is two seperate macros I have recorded which I
want to combine with an input box, can anybody give me an example that
I can copy and paste into the macro??


--
Drummy
------------------------------------------------------------------------
Drummy's Profile: http://www.excelforum.com/member.php...o&userid=34780
View this thread: http://www.excelforum.com/showthread...hreadid=549324


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
write a macro to input data JPreeshl Excel Discussion (Misc queries) 2 May 6th 06 09:25 PM
Can you pause a macro in excel to input data and continue? Hutch Excel Discussion (Misc queries) 1 May 5th 06 06:16 PM
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Macro to move to specified cells, pause for input at each? Pete in Montrose Excel Discussion (Misc queries) 1 March 5th 05 06:18 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 02:59 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"