Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Sorting Columns Independently Followup From 3/13

I need to add a line to the macro, so that it only works on a sheet named
"sort". This is so if the short cut to run the macro is run by accident (when
another sheet tab is the current worksheet) it only affects the data on the
"sort" worksheet. How do you identify which sheet of a workbook a macro is
assigned to run in...and that sheet only, even if you are working in another
worksheet (same workbook though)?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Sorting Columns Independently Followup From 3/13

Insert this line as 1st line of your macro:
Worksheets("sort").Select
Regards,
Stefi


€˛curtc.€¯ ezt Ć*rta:

I need to add a line to the macro, so that it only works on a sheet named
"sort". This is so if the short cut to run the macro is run by accident (when
another sheet tab is the current worksheet) it only affects the data on the
"sort" worksheet. How do you identify which sheet of a workbook a macro is
assigned to run in...and that sheet only, even if you are working in another
worksheet (same workbook though)?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Sorting Columns Independently Followup From 3/13

I think it would be better to qualify your ranges.

Instead of

range("A1:B99").sort key1:=range("a1"), ...

use

with worksheets("Sort")
.range("a1:B99").sort key1:=.range("A1"), ....
end with

The dots in front of those .Range()'s means that they belong to the object in
the previous with. In this case, that's the Sort worksheet.

If you have trouble adjusting your code, post what you have and I'm sure you'll
get help.

curtc. wrote:

I need to add a line to the macro, so that it only works on a sheet named
"sort". This is so if the short cut to run the macro is run by accident (when
another sheet tab is the current worksheet) it only affects the data on the
"sort" worksheet. How do you identify which sheet of a workbook a macro is
assigned to run in...and that sheet only, even if you are working in another
worksheet (same workbook though)?


--

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
sorting columns at the same time but independently of each other curtc. Excel Discussion (Misc queries) 4 April 4th 23 11:20 AM
Group adjacent columns independently Tigerxxx Excel Discussion (Misc queries) 3 February 21st 09 06:58 PM
Filtering columns independently Youssef B. Excel Discussion (Misc queries) 4 September 25th 08 09:39 PM
Sorting data rows independently guillemot Excel Discussion (Misc queries) 0 December 22nd 05 04:54 AM
countif followup Lee Harris Excel Worksheet Functions 3 November 16th 05 06:13 AM


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