Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Active Cell - Remember

Hello all,

I have a macro (recorded) which sorts data - approx 1,000 rows. Before the
sort the active cell could be C504 but after the sort the data that was
contained in that cell may have moved to say C11. I'm trying to get the
active cell to move to the new location. Does anyone have any ideas? I was
toying with copying cell contents to clipboard pre-sort and then pasting the
data into the find function - this is straightforward manually but no idea
how to automate. Maybe there's a better way?

I'm grateful for any help.

Paul.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Active Cell - Remember

Sub sorta()
Dim myvalue As String

myvalue = ActiveCell.Value

' Do your sort routine here.
' Example sort line:
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

' The next line will find the original value
Cells.Find(What:=myvalue, SearchOrder:=xlByColumns).Activate
End Sub

Mike F
"Paul Brown" wrote in message
...
Hello all,

I have a macro (recorded) which sorts data - approx 1,000 rows. Before the
sort the active cell could be C504 but after the sort the data that was
contained in that cell may have moved to say C11. I'm trying to get the
active cell to move to the new location. Does anyone have any ideas? I was
toying with copying cell contents to clipboard pre-sort and then pasting
the data into the find function - this is straightforward manually but no
idea how to automate. Maybe there's a better way?

I'm grateful for any help.

Paul.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Active Cell - Remember

But what if there are duplicate values of myvalue?
Stefi


€˛Mike Fogleman€¯ ezt Ć*rta:

Sub sorta()
Dim myvalue As String

myvalue = ActiveCell.Value

' Do your sort routine here.
' Example sort line:
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

' The next line will find the original value
Cells.Find(What:=myvalue, SearchOrder:=xlByColumns).Activate
End Sub

Mike F
"Paul Brown" wrote in message
...
Hello all,

I have a macro (recorded) which sorts data - approx 1,000 rows. Before the
sort the active cell could be C504 but after the sort the data that was
contained in that cell may have moved to say C11. I'm trying to get the
active cell to move to the new location. Does anyone have any ideas? I was
toying with copying cell contents to clipboard pre-sort and then pasting
the data into the find function - this is straightforward manually but no
idea how to automate. Maybe there's a better way?

I'm grateful for any help.

Paul.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Active Cell - Remember

Before sorting you could use a blank column and fill this with the
sequence 1,2,3 etc. Include this column in your sort range. Then if the
active cell had been C504, you just need to search for 504 in this
helper column - the column can be deleted when not needed.

Pete

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Active Cell - Remember

Clever!
Regards,
Stefi


€˛Pete€¯ ezt Ć*rta:

Before sorting you could use a blank column and fill this with the
sequence 1,2,3 etc. Include this column in your sort range. Then if the
active cell had been C504, you just need to search for 504 in this
helper column - the column can be deleted when not needed.

Pete




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Active Cell - Remember

Thanks all,

Guidance much appreciated.

Paul.

"Stefi" wrote in message
...
Clever!
Regards,
Stefi


"Pete" ezt ķrta:

Before sorting you could use a blank column and fill this with the
sequence 1,2,3 etc. Include this column in your sort range. Then if the
active cell had been C504, you just need to search for 504 in this
helper column - the column can be deleted when not needed.

Pete




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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
Can a cell remember a number?... Markv Excel Discussion (Misc queries) 4 June 23rd 08 10:49 AM
Why and How Does Excel Remember The Last Cell? Jim J. Excel Worksheet Functions 2 April 30th 07 10:50 PM
How do I get a cell to remember the last entry and add to it? jab Excel Discussion (Misc queries) 7 March 4th 05 05:30 PM
Remember a cell scrabtree[_2_] Excel Programming 2 September 16th 04 10:08 PM


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