Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() When a user clicks and drags to highlight a range, how do I identify that range in a macro? Say the user highlights cells E6:G17, I want to give them the ability to click a button that will do several things to that range. I have tested my macro, but only when I have used a known range. -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=535965 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
That is Selection, as in
Msgbox Selection.Address -- HTH Bob Phillips (remove nothere from email address if mailing direct) "DCSwearingen" wrote in message news:DCSwearingen.26trd2_1145976316.3013@excelforu m-nospam.com... When a user clicks and drags to highlight a range, how do I identify that range in a macro? Say the user highlights cells E6:G17, I want to give them the ability to click a button that will do several things to that range. I have tested my macro, but only when I have used a known range. -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=535965 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Here is a example of the With Selection: Private Sub CommandButton1_Click() With Selection .Value = 1 End With End Sub Regards, Bondi |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can use Selection to get the user's current selection.
Dim myCell as range for each mycell in selection.cells ... next mycell In fact, you could toss up an inputbox that allows the user to select the range. Dim myRng as range set myrng =nothing on error resume next set myrng = application.inputbox(Prompt:="Select a range!", type:=8) on error goto 0 if myrng is nothing then 'user hit cancel else msgbox myrng.address end if DCSwearingen wrote: When a user clicks and drags to highlight a range, how do I identify that range in a macro? Say the user highlights cells E6:G17, I want to give them the ability to click a button that will do several things to that range. I have tested my macro, but only when I have used a known range. -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=535965 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Thank You for Responding! I have been searching the help file all morning for this! -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=535965 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
format macro | Excel Discussion (Misc queries) | |||
checking that cells have a value before the workbook will close | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Name a Range - Macro | Excel Worksheet Functions | |||
Match function...random search? | Excel Worksheet Functions |