Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Need VBA Code to Let User Define Active Sheet

I have a macro that currently pops up a windows explorer box to allow the
user to find an excel spreadsheet to run the macro on. I would like to
change the macro to allow the user to select a currently open active excel
spread sheet on their desktop instead. Any Ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need VBA Code to Let User Define Active Sheet

Maybe you could just use something like:

dim myCell as range
set mycell = nothing
on error resume next
set mycell = application.inputbox(Prompt:="pick a cell on any worksheet", _
type:=8)
on error goto 0
if mycell is nothing then
'user hit cancel
exit sub
end if

msgbox mycell.address _
& vblf & mycell.parent.name _
& vblf & mycell.parent.parent.name

====
Tell them to use Window to get to the other workbooks.

=========
Alternatively, you could create a userform that has a combobox that displays all
the open workbooks and let them choose from one of them.

Look at Chip Pearson's site:
http://www.cpearson.com/excel/download.htm
and look for the Compare utility that Bill Manville and Myrna Larson wrote.

You may be able to borrow lots of code from that.

zulfer7 wrote:

I have a macro that currently pops up a windows explorer box to allow the
user to find an excel spreadsheet to run the macro on. I would like to
change the macro to allow the user to select a currently open active excel
spread sheet on their desktop instead. Any Ideas?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Need VBA Code to Let User Define Active Sheet

Thanks Dave for responding to my inquiry. The macro you gave me again only
looks at the currently active sheet and the link you provided to the compare
macro does the same, it only lists open sheets within the same workbook. I
kind of found a work around in that the user can manually paste in a column
of data which is kindof the next best thing to being able to go to another
spreadsheet and pick a range.

Thanks!

"Dave Peterson" wrote:

Maybe you could just use something like:

dim myCell as range
set mycell = nothing
on error resume next
set mycell = application.inputbox(Prompt:="pick a cell on any worksheet", _
type:=8)
on error goto 0
if mycell is nothing then
'user hit cancel
exit sub
end if

msgbox mycell.address _
& vblf & mycell.parent.name _
& vblf & mycell.parent.parent.name

====
Tell them to use Window to get to the other workbooks.

=========
Alternatively, you could create a userform that has a combobox that displays all
the open workbooks and let them choose from one of them.

Look at Chip Pearson's site:
http://www.cpearson.com/excel/download.htm
and look for the Compare utility that Bill Manville and Myrna Larson wrote.

You may be able to borrow lots of code from that.

zulfer7 wrote:

I have a macro that currently pops up a windows explorer box to allow the
user to find an excel spreadsheet to run the macro on. I would like to
change the macro to allow the user to select a currently open active excel
spread sheet on their desktop instead. Any Ideas?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need VBA Code to Let User Define Active Sheet

You can choose another open workbook via the Window option on the menubar.

Then you can select any sheet you want in that workbook. And choose a cell
there.

And the Compare written by Myrna Larson and Bill Manville shows all the
worksheets in all the open workbooks.



zulfer7 wrote:

Thanks Dave for responding to my inquiry. The macro you gave me again only
looks at the currently active sheet and the link you provided to the compare
macro does the same, it only lists open sheets within the same workbook. I
kind of found a work around in that the user can manually paste in a column
of data which is kindof the next best thing to being able to go to another
spreadsheet and pick a range.

Thanks!

"Dave Peterson" wrote:

Maybe you could just use something like:

dim myCell as range
set mycell = nothing
on error resume next
set mycell = application.inputbox(Prompt:="pick a cell on any worksheet", _
type:=8)
on error goto 0
if mycell is nothing then
'user hit cancel
exit sub
end if

msgbox mycell.address _
& vblf & mycell.parent.name _
& vblf & mycell.parent.parent.name

====
Tell them to use Window to get to the other workbooks.

=========
Alternatively, you could create a userform that has a combobox that displays all
the open workbooks and let them choose from one of them.

Look at Chip Pearson's site:
http://www.cpearson.com/excel/download.htm
and look for the Compare utility that Bill Manville and Myrna Larson wrote.

You may be able to borrow lots of code from that.

zulfer7 wrote:

I have a macro that currently pops up a windows explorer box to allow the
user to find an excel spreadsheet to run the macro on. I would like to
change the macro to allow the user to select a currently open active excel
spread sheet on their desktop instead. Any Ideas?


--

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
What is the code for the active worksheet? Dr Dan[_2_] Excel Discussion (Misc queries) 12 February 23rd 07 03:12 PM
User define function lee Excel Discussion (Misc queries) 4 February 11th 07 12:33 AM
delete user define setting BNT1 via OfficeKB.com Charts and Charting in Excel 3 January 18th 07 07:00 PM
Define Name in active cell Danny Excel Worksheet Functions 0 October 13th 05 06:20 PM
Looking for code to define a range Ant Excel Discussion (Misc queries) 3 October 3rd 05 06:22 PM


All times are GMT +1. The time now is 04:31 PM.

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"