ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Including an input box within a macro (https://www.excelbanter.com/excel-programming/363381-including-input-box-within-macro.html)

Drummy[_3_]

Including an input box within 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

identify as 'the treasurer' and delete all 'financial' data
(G3:H17 & K3:K17) or
identify as 'the registrar' and delete all 'results' data
(E3:I17)

how do I this?


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


Bob Phillips

Including an input box within a macro
 
If you use Application Inputbox with a type of 8, you can allow the user to
select the columns rather than type it in

Dim rng As Range

Set rng = Application.Inputbox("Select appropriate data",Type:=8)

If not rng Is Nothing Then
rng.EntireColumn.Delete
End If

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Drummy" wrote in
message ...

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

identify as 'the treasurer' and delete all 'financial' data
(G3:H17 & K3:K17) or
identify as 'the registrar' and delete all 'results' data
(E3:I17)

how do I this?


--
Drummy
------------------------------------------------------------------------
Drummy's Profile:

http://www.excelforum.com/member.php...o&userid=34780
View this thread: http://www.excelforum.com/showthread...hreadid=548868





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com