#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Active Cell

I'm trying to create a macro. I am referencing cell A1 in 'Sheet2' to cell
A20 in 'Sheet1'. How do I make the Active Cell A1 in 'Sheet1'??? Thanks

~Justin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Active Cell

Hi,

You do that by selecting it

Sheets("Sheet1").Range("A1").Select

But it's very unlikely you need to do that. Selecting slows things down and
more often than not isn't necessary.

Mike

"soldier1981" wrote:

I'm trying to create a macro. I am referencing cell A1 in 'Sheet2' to cell
A20 in 'Sheet1'. How do I make the Active Cell A1 in 'Sheet1'??? Thanks

~Justin

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Active Cell

As Mike said, it is very unlikely you need to select anything. If you would
describe what you are trying to do in more detail (include your current
relevant code, working or not), I think we can show you code that does not
use Selections at all.

In the meantime, perhaps this previous posting of mine (a response to
another person using Select/Selection type constructions) will be of some
help
to you in your future programming...
Whenever you see code constructed like this...

Range("A1").Select
Selection.<whatever

you can almost always do this instead...

Range("A1").<whatever

In your particular case, you have this...

Range("C2:C8193").Select 'select cells to export
For Each r In Selection.Rows

which, using the above concept, can be reduced to this...

For Each r In Range("C2:C8193").Rows

Notice, all I have done is replace Selection with the range you Select(ed)
in the previous statement and eliminate the process of
doing any Select(ion)s. Stated another way, the Selection produced from
Range(...).Select is a range and, of course, Range(...) is a
range... and, in fact, they are the same range, so it doesn't matter which
one you use. The added benefit of not selecting ranges
first is your active cell does not change.

--
Rick (MVP - Excel)


"soldier1981" wrote in message
...
I'm trying to create a macro. I am referencing cell A1 in 'Sheet2' to
cell
A20 in 'Sheet1'. How do I make the Active Cell A1 in 'Sheet1'??? Thanks

~Justin


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
run macro although blinking cursor is active in an active cell bartman1980 Excel Programming 1 December 20th 07 11:29 AM
referring to formula in a non active cell from active cell nickname Excel Discussion (Misc queries) 1 June 21st 07 12:11 PM
I need to sort an active sheet using the col of the active cell HamFlyer Excel Programming 3 June 6th 06 07:25 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Excel Programming 3 January 23rd 06 09:57 PM


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