Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Use mouse to select sheet

I am attempting to allow users to select a worksheet using the mouse and
then copy that sheet to a new sheet.
I am using this formula:-

Dim rng as Range
On Error Resume Next
set rng = Application.InputBox("use mouse to select any cell in desired
sheet", Type:=8)
On Error goto 0
if not rng is nothing then
msgbox "You selected the sheet named: " & rng.parent.name
else
msgbox "You hit cancel"
End If

Cells.Select
Selection.Copy

However when a sheet is selected, I am simply returned to the active sheet.

Help


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Use mouse to select sheet

Hi,

Try this

rng.Parent.Select
Cells.Select
Selection.Copy


Mike


On Sun, 17 May 2009 10:18:13 +0200, "Jeff Kelly"
wrote:

I am attempting to allow users to select a worksheet using the mouse and
then copy that sheet to a new sheet.
I am using this formula:-

Dim rng as Range
On Error Resume Next
set rng = Application.InputBox("use mouse to select any cell in desired
sheet", Type:=8)
On Error goto 0
if not rng is nothing then
msgbox "You selected the sheet named: " & rng.parent.name
else
msgbox "You hit cancel"
End If

Cells.Select
Selection.Copy

However when a sheet is selected, I am simply returned to the active sheet.

Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Use mouse to select sheet

Hi!

Try this way:

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox("use mouse to select any cell in
desiredSheet ", Type:=8)
On Error GoTo 0

If Not rng Is Nothing Then
With rng.Parent
.Activate
MsgBox "You selected the sheet named: " & .Name
.Cells.Copy
End With
Else
MsgBox "You hit cancel"
End If




Ο χρήστης "Mike H" *γγραψε:

Hi,

Try this

rng.Parent.Select
Cells.Select
Selection.Copy


Mike


On Sun, 17 May 2009 10:18:13 +0200, "Jeff Kelly"
wrote:

I am attempting to allow users to select a worksheet using the mouse and
then copy that sheet to a new sheet.
I am using this formula:-

Dim rng as Range
On Error Resume Next
set rng = Application.InputBox("use mouse to select any cell in desired
sheet", Type:=8)
On Error goto 0
if not rng is nothing then
msgbox "You selected the sheet named: " & rng.parent.name
else
msgbox "You hit cancel"
End If

Cells.Select
Selection.Copy

However when a sheet is selected, I am simply returned to the active sheet.

Help


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Use mouse to select sheet

Probably better to check to see if that range was successful:

dim rng as rng

set rng = nothing
on error resume next
set rng = application.inputbox("use...", type:=8)
on error goto 0

if rng is nothing then
'exit sub '???
else
'do the work here
rng.parent.cells.copy
...
end if





Jeff Kelly wrote:

I am attempting to allow users to select a worksheet using the mouse and
then copy that sheet to a new sheet.
I am using this formula:-

Dim rng as Range
On Error Resume Next
set rng = Application.InputBox("use mouse to select any cell in desired
sheet", Type:=8)
On Error goto 0
if not rng is nothing then
msgbox "You selected the sheet named: " & rng.parent.name
else
msgbox "You hit cancel"
End If

Cells.Select
Selection.Copy

However when a sheet is selected, I am simply returned to the active sheet.

Help


--

Dave Peterson
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
Not able to select range of cells with mouse. jen New Users to Excel 2 September 16th 09 06:21 PM
How can I select a range manually with the mouse? ian Excel Programming 10 October 31st 07 12:31 AM
How to select Chart without using Mouse? Rajkumar Charts and Charting in Excel 1 July 30th 07 09:04 PM
Using mouse to select a single cell within the worksheet Mike B. Excel Discussion (Misc queries) 1 July 30th 07 01:52 AM
[Help]Excel mouse select region bot Excel Programming 0 November 8th 05 04:41 AM


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