Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Reselect cell after macro

Hi,
I have a range of cells used to input numbers 0 through 9. There are other cells that count the occurances of each number in that range (Count If 0, Count If 1, ...). After 20 entries a macro runs to copy/paste the quantity of each number ( # of 0's, # of 1's, # of 2's, ...) into 10 other cells.
Problem: How do I get Excel to reselect the cell that was selected before the macro ran? This cell could be any one in the data input range.
Any help would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Reselect cell after macro

Hi one way:
sub foo()
Dim rng as range
set rng = activecell
....' your code
rng.select
end sub

Frank

gman wrote:
Hi,
I have a range of cells used to input numbers 0 through 9. There are
other cells that count the occurances of each number in that range
(Count If 0, Count If 1, ...). After 20 entries a macro runs to
copy/paste the quantity of each number ( # of 0's, # of 1's, # of
2's, ...) into 10 other cells. Problem: How do I get Excel to
reselect the cell that was selected before the macro ran? This cell
could be any one in the data input range.
Any help would be greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reselect cell after macro

Put in at the end of the macro:

Sheet1.Range("A1").Select

Change Sheet and Cell reference as needed.

Cheer

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Reselect cell after macro

Frank
Works perfectly, thanks!
This discussion group is an excellent and invaluable resource.

----- Frank Kabel wrote: ----

Hi one way
sub foo(
Dim rng as rang
set rng = activecel
....' your cod
rng.selec
end su

Fran

gman wrote
Hi
I have a range of cells used to input numbers 0 through 9. There ar
other cells that count the occurances of each number in that rang
(Count If 0, Count If 1, ...). After 20 entries a macro runs t
copy/paste the quantity of each number ( # of 0's, # of 1's, # o
2's, ...) into 10 other cells. Problem: How do I get Excel t
reselect the cell that was selected before the macro ran? This cel
could be any one in the data input range.
Any help would be greatly appreciated




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
Macro to transfer contents of 'Selected' cell to alternate cell. Gryndar Excel Worksheet Functions 7 December 20th 08 09:58 PM
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


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