Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default user interaction to select a sheet

Hello.

I would like the user to be able to click on a cell in a sheet to tell the
program where something is.

1) Click a command button to start the program
2) Ask the user where the first sheet to work with is
3) Ask the user where the second sheet to work with is

I'm thinking it would work something like the little ranger finder icon that
you use to define a consolidation range or a Pivot Table's input... or
something like that. But I don't know how to throw up that dialog box to let
the user click on a cell or highlight a group of cells, and then continue on.

Can someone help me with just that piece?

Thanks.
Mark
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default user interaction to select a sheet

You can use an application.inputbox to get a range and use the .parent property
to get the worksheet that owns that range:

Dim wks1 as worksheet
dim wks2 as worksheet

set wks1 = nothing
on error resume next
set wks1 = application.inputbox(Prompt:="select a cell on the 1st worksheet", _
type:=8).parent
on error goto 0

if wks1 is nothing then
'user hit cancel
exit sub
end if

set wks2 = nothing
on error resume next
set wks2 = application.inputbox(Prompt:="select a cell on the 2nd worksheet", _
type:=8).parent
on error goto 0

if wks2 is nothing then
'user hit cancel
exit sub
end if

msgbox wks1.name & vblf & wks2.name

(untested, uncompiled--watch for typos.)

=============
As an alternative, you could build a small userform that has a couple of
comboboxes that allows the users to pick from the available worksheets (from the
workbooks that are open).

If you want to see an example, take a look at this compare addin developed by
Myrna Larson and Bill Manville.

http://www.cpearson.com/excel/whatsnew.htm
look for compare.xla

You may find that it's easier for most users, too.

If you've never created a user form, Debra Dalgleish has a short tutorial:
http://contextures.com/xlUserForm01.html

mark wrote:

Hello.

I would like the user to be able to click on a cell in a sheet to tell the
program where something is.

1) Click a command button to start the program
2) Ask the user where the first sheet to work with is
3) Ask the user where the second sheet to work with is

I'm thinking it would work something like the little ranger finder icon that
you use to define a consolidation range or a Pivot Table's input... or
something like that. But I don't know how to throw up that dialog box to let
the user click on a cell or highlight a group of cells, and then continue on.

Can someone help me with just that piece?

Thanks.
Mark


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default user interaction to select a sheet

Dave,

Thanks for the ideas.

I had thought of the userform idea to display available workbooks and
sheets. I've developed lots of userforms and could do that easily enough.

I may also look at the compare.xls file that you mentioned. It was a
comparison of two things that I did manually which someone liked a lot that
had me considerating automating for them.

Thanks again,
Mark

"Dave Peterson" wrote:

You can use an application.inputbox to get a range and use the .parent property
to get the worksheet that owns that range:

Dim wks1 as worksheet
dim wks2 as worksheet

set wks1 = nothing
on error resume next
set wks1 = application.inputbox(Prompt:="select a cell on the 1st worksheet", _
type:=8).parent
on error goto 0

if wks1 is nothing then
'user hit cancel
exit sub
end if

set wks2 = nothing
on error resume next
set wks2 = application.inputbox(Prompt:="select a cell on the 2nd worksheet", _
type:=8).parent
on error goto 0

if wks2 is nothing then
'user hit cancel
exit sub
end if

msgbox wks1.name & vblf & wks2.name

(untested, uncompiled--watch for typos.)

=============
As an alternative, you could build a small userform that has a couple of
comboboxes that allows the users to pick from the available worksheets (from the
workbooks that are open).

If you want to see an example, take a look at this compare addin developed by
Myrna Larson and Bill Manville.

http://www.cpearson.com/excel/whatsnew.htm
look for compare.xla

You may find that it's easier for most users, too.

If you've never created a user form, Debra Dalgleish has a short tutorial:
http://contextures.com/xlUserForm01.html

mark wrote:

Hello.

I would like the user to be able to click on a cell in a sheet to tell the
program where something is.

1) Click a command button to start the program
2) Ask the user where the first sheet to work with is
3) Ask the user where the second sheet to work with is

I'm thinking it would work something like the little ranger finder icon that
you use to define a consolidation range or a Pivot Table's input... or
something like that. But I don't know how to throw up that dialog box to let
the user click on a cell or highlight a group of cells, and then continue on.

Can someone help me with just that piece?

Thanks.
Mark


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default user interaction to select a sheet

Dave,

I just tested the input box idea that you suggested. It will work fine.

I also looked at the compare.xla that you referred me to. The application
that I was considering programming is similar to that, but slightly
different, of course. In my specific situation, I think programming it
myself will fit what the user needs, better, and it won't take me long.

Thanks again,
Mark

"Dave Peterson" wrote:

You can use an application.inputbox to get a range and use the .parent property
to get the worksheet that owns that range:

Dim wks1 as worksheet
dim wks2 as worksheet

set wks1 = nothing
on error resume next
set wks1 = application.inputbox(Prompt:="select a cell on the 1st worksheet", _
type:=8).parent
on error goto 0

if wks1 is nothing then
'user hit cancel
exit sub
end if

set wks2 = nothing
on error resume next
set wks2 = application.inputbox(Prompt:="select a cell on the 2nd worksheet", _
type:=8).parent
on error goto 0

if wks2 is nothing then
'user hit cancel
exit sub
end if

msgbox wks1.name & vblf & wks2.name

(untested, uncompiled--watch for typos.)

=============
As an alternative, you could build a small userform that has a couple of
comboboxes that allows the users to pick from the available worksheets (from the
workbooks that are open).

If you want to see an example, take a look at this compare addin developed by
Myrna Larson and Bill Manville.

http://www.cpearson.com/excel/whatsnew.htm
look for compare.xla

You may find that it's easier for most users, too.

If you've never created a user form, Debra Dalgleish has a short tutorial:
http://contextures.com/xlUserForm01.html

mark wrote:

Hello.

I would like the user to be able to click on a cell in a sheet to tell the
program where something is.

1) Click a command button to start the program
2) Ask the user where the first sheet to work with is
3) Ask the user where the second sheet to work with is

I'm thinking it would work something like the little ranger finder icon that
you use to define a consolidation range or a Pivot Table's input... or
something like that. But I don't know how to throw up that dialog box to let
the user click on a cell or highlight a group of cells, and then continue on.

Can someone help me with just that piece?

Thanks.
Mark


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default user interaction to select a sheet

Sometimes, training users to use Window on the worksheet menubar can be a pain.
Using the combobox can make it easier to select different worksheets.

mark wrote:

Dave,

I just tested the input box idea that you suggested. It will work fine.

I also looked at the compare.xla that you referred me to. The application
that I was considering programming is similar to that, but slightly
different, of course. In my specific situation, I think programming it
myself will fit what the user needs, better, and it won't take me long.

Thanks again,
Mark

"Dave Peterson" wrote:

You can use an application.inputbox to get a range and use the .parent property
to get the worksheet that owns that range:

Dim wks1 as worksheet
dim wks2 as worksheet

set wks1 = nothing
on error resume next
set wks1 = application.inputbox(Prompt:="select a cell on the 1st worksheet", _
type:=8).parent
on error goto 0

if wks1 is nothing then
'user hit cancel
exit sub
end if

set wks2 = nothing
on error resume next
set wks2 = application.inputbox(Prompt:="select a cell on the 2nd worksheet", _
type:=8).parent
on error goto 0

if wks2 is nothing then
'user hit cancel
exit sub
end if

msgbox wks1.name & vblf & wks2.name

(untested, uncompiled--watch for typos.)

=============
As an alternative, you could build a small userform that has a couple of
comboboxes that allows the users to pick from the available worksheets (from the
workbooks that are open).

If you want to see an example, take a look at this compare addin developed by
Myrna Larson and Bill Manville.

http://www.cpearson.com/excel/whatsnew.htm
look for compare.xla

You may find that it's easier for most users, too.

If you've never created a user form, Debra Dalgleish has a short tutorial:
http://contextures.com/xlUserForm01.html

mark wrote:

Hello.

I would like the user to be able to click on a cell in a sheet to tell the
program where something is.

1) Click a command button to start the program
2) Ask the user where the first sheet to work with is
3) Ask the user where the second sheet to work with is

I'm thinking it would work something like the little ranger finder icon that
you use to define a consolidation range or a Pivot Table's input... or
something like that. But I don't know how to throw up that dialog box to let
the user click on a cell or highlight a group of cells, and then continue on.

Can someone help me with just that piece?

Thanks.
Mark


--

Dave Peterson


--

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
Let User Select Sheet to Pull Data From opieandy Excel Discussion (Misc queries) 7 July 11th 09 05:29 AM
How Email does not need user interaction ? Koulla Excel Discussion (Misc queries) 4 October 15th 08 02:41 PM
programmatically add Outlook control for user interaction/feedback Loane Sharp[_2_] Excel Programming 0 May 13th 06 09:24 AM
Separating Business Logic from User Interaction (Userforms) chatterbox Excel Programming 0 November 24th 05 11:38 AM
Modeless form for user interaction Arne[_2_] Excel Programming 6 July 15th 03 02:22 PM


All times are GMT +1. The time now is 01:53 AM.

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"