Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default to change the macros as per active cell and range

Hi all,
Need your help to change the formula .
Columns("Q:Q").Select
Range("Q1").Activate

How I can change the above macros with active cell and active cell range

For example

If the cursor is in A1column the macro should be

COlumn(A:A).select
Range("A1).activate

If the cursor is in K column the macro should be

COlumn(K:K).select
Range("K1).activate

With thanks

Pol


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default to change the macros as per active cell and range

Try

Columns(ActiveCell.Column).Select
Cells(1, ActiveCell.Column).Activate

If this post helps click Yes
---------------
Jacob Skaria


"pol" wrote:

Hi all,
Need your help to change the formula .
Columns("Q:Q").Select
Range("Q1").Activate

How I can change the above macros with active cell and active cell range

For example

If the cursor is in A1column the macro should be

COlumn(A:A).select
Range("A1).activate

If the cursor is in K column the macro should be

COlumn(K:K).select
Range("K1).activate

With thanks

Pol


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default to change the macros as per active cell and range

Another one:

With ActiveCell.EntireColumn
.Select
.Cells(1).Activate
End With

In my simple tests, I didn't even need the .activate statement, but I'd keep
it. It makes the code more self-documenting.

pol wrote:

Hi all,
Need your help to change the formula .
Columns("Q:Q").Select
Range("Q1").Activate

How I can change the above macros with active cell and active cell range

For example

If the cursor is in A1column the macro should be

COlumn(A:A).select
Range("A1).activate

If the cursor is in K column the macro should be

COlumn(K:K).select
Range("K1).activate

With thanks

Pol


--

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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
use active cell to determine range Gizmo Excel Discussion (Misc queries) 2 March 31st 08 04:55 AM
Clearly seeing active cell in a range dsa Excel Discussion (Misc queries) 2 March 24th 08 03:22 PM
Active Cell To Change Formula PaulW Excel Discussion (Misc queries) 7 September 21st 06 04:03 PM
Change Formatting In 'Active' Cell JB2010 Excel Discussion (Misc queries) 4 February 2nd 06 05:58 PM


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