Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Selecting a cell during a macro

Selecting a cell during a macro
I want the user to be able to use the mouse to click on the position for the
rest of the macro to run.
A form asks the user to select the correct position. At present I have this
done by getting the row number typed in to the form (or the number of rows up
or down to move). This is rather awkward and old-fashioned and I would like
the form just to tell the user to click on the required position.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Selecting a cell during a macro

Sue,

Not sure if this is the answer your looking for but,

Load your user form as vbModeless; so Userform.show vbModeless, then you can
click anywhere on the sheet you want to. Then make sure that your macro runs
on the activecell.

Cheers,

Paul

"Sue" wrote:

Selecting a cell during a macro
I want the user to be able to use the mouse to click on the position for the
rest of the macro to run.
A form asks the user to select the correct position. At present I have this
done by getting the row number typed in to the form (or the number of rows up
or down to move). This is rather awkward and old-fashioned and I would like
the form just to tell the user to click on the required position.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Selecting a cell during a macro

On Feb 21, 10:13*am, Paul wrote:
Sue,

Not sure if this is the answer your looking for but,

Load your user form as vbModeless; so Userform.show vbModeless, then you can
click anywhere on the sheet you want to. Then make sure that your macro runs
on the activecell.

Cheers,

Paul



"Sue" wrote:
Selecting a cell during a macro
I want the user to be able to use the mouse to click on the position for the
rest of the macro to run.
A form asks the user to select the correct position. At present I have this
done by getting the row number typed in to the form (or the number of rows up
or down to move). This is rather awkward and old-fashioned and I would like
the form just to tell the user to click on the required position.- Hide quoted text -


- Show quoted text -


Hi
Two ways:

1. Put a RefEdit control on your userform. This is available from the
Toolbox when creating a Userform. It is the one which allows the user
to select a Range with the mouse.
Then
Set myRange = Userform1.myRefEditControl.Value
If not myRange is nothing then
'code using myRange
End if
2. If you don't have a userform use the Application inputbox

Set myRange = Application.Inputbox("Please Select a Range with the
Mouse", Type:=8)
If not myRange is nothing then
'code using myRange
End if

This will display the inputbox with an OK and Cancel Button. If Cancel
is clicked then myRange is Nothing. The Type 8 setting is for a Range
as input.

regards
Paul

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Selecting a cell during a macro

the application.inputbox does exactly what you need...


Sub text_this()

Dim rChosen As Range

Set rChosen = Application.InputBox("Select a cell or range", Type:=8)

rChosen.Interior.Color = vbBlue

End Sub

"Sue" wrote:

Selecting a cell during a macro
I want the user to be able to use the mouse to click on the position for the
rest of the macro to run.
A form asks the user to select the correct position. At present I have this
done by getting the row number typed in to the form (or the number of rows up
or down to move). This is rather awkward and old-fashioned and I would like
the form just to tell the user to click on the required position.

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
Macro Pause for selecting cell jo2109 Excel Discussion (Misc queries) 3 June 4th 09 02:05 AM
macro selecting row that cursor is on (not the same cell every tim Jeremy Excel Discussion (Misc queries) 8 May 19th 08 05:09 PM
Help for Macro: Finding last cell and selecting it [email protected] Excel Discussion (Misc queries) 4 January 29th 07 08:40 AM
Macro - Selecting Next Available Cell cappuccine Excel Programming 11 November 3rd 05 10:19 PM
Macro selecting the last used cell does not work Kaj Pedersen Excel Programming 1 November 4th 03 10:25 PM


All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"