![]() |
Asking for a group of cells
I'm looking for an instruction to be used into a macro which gives the
possibility to interrupt the macro until you select a group of cells with the mouse. Then the macro has to perform some operations on the selected cells. I tried with InputBox but it does not permit to select a range of cells with the mouse, you can only write it with the keyboard, for example: "a1:a10". Could you suggest me something about this problem? I would like some windows like the ones you use when you select data for a graphic. Thank you. |
Asking for a group of cells
use Application.Inputbox
with the Type parameter set to 8 , range. read help on this, its reasonable good Patrick Molloy Microsoft Excel MVP -----Original Message----- I'm looking for an instruction to be used into a macro which gives the possibility to interrupt the macro until you select a group of cells with the mouse. Then the macro has to perform some operations on the selected cells. I tried with InputBox but it does not permit to select a range of cells with the mouse, you can only write it with the keyboard, for example: "a1:a10". Could you suggest me something about this problem? I would like some windows like the ones you use when you select data for a graphic. Thank you. . |
Asking for a group of cells
Max,
You need Application.Inputbox. If you use this with a type of 8 you can select a range of cells, and the address of these cells is returned to Inputbox. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Max_Venezia" wrote in message om... I'm looking for an instruction to be used into a macro which gives the possibility to interrupt the macro until you select a group of cells with the mouse. Then the macro has to perform some operations on the selected cells. I tried with InputBox but it does not permit to select a range of cells with the mouse, you can only write it with the keyboard, for example: "a1:a10". Could you suggest me something about this problem? I would like some windows like the ones you use when you select data for a graphic. Thank you. |
Asking for a group of cells
Max,
Try something like the following code: Dim SelectedRange As Range On Error Resume Next Set SelectedRange = Application.InputBox( _ prompt:="Select A Range", Type:=8) If SelectedRange Is Nothing Then MsgBox "You clicked cancel" Else MsgBox "You selected: " & SelectedRange.Address End If On Error GoTo 0 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Max_Venezia" wrote in message om... I'm looking for an instruction to be used into a macro which gives the possibility to interrupt the macro until you select a group of cells with the mouse. Then the macro has to perform some operations on the selected cells. I tried with InputBox but it does not permit to select a range of cells with the mouse, you can only write it with the keyboard, for example: "a1:a10". Could you suggest me something about this problem? I would like some windows like the ones you use when you select data for a graphic. Thank you. |
Asking for a group of cells
Hi Max,
I would have the InputBox use a default of the activecell or the current selection. See webpage: InputBox and MsgBox http://www.mvps.org/dmcritchie/excel/inputbox.htm and the specific example: Multiple Range Selection in InputBox (#multi) http://www.mvps.org/dmcritchie/excel/inputbox.htm#multi --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm |
All times are GMT +1. The time now is 02:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com