Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 1
Default worksheetselectionchange function to run macro

Hi Gurus

I am not a VB programmer but I know where to write code for worksheet
selectionchange.

I want to run a macro on entry in any cell of column "A". in short I
want a row of formulas to be copied for a raneg (B*.AW*). I don't want
memory to be cosumed by keeping the formulas entered by default.

  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 2
Default worksheetselectionchange function to run macro

Sudarshan

The SelectionChange event has a parameter called Range. This holds the
address (cell, row or column) of the selected cell, so you can use this to
place the formula (I've used Offset and presumed you are storing the
formulae in the range B1:AW1, although of course you could set the formula
of each cell in the row using the WorksheetFunction property of the
Application object)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
Range("B1:AW1").Copy Destination:=Target.Offset(0, 1)
End If
End Sub

Now the next issue is how you tell Excel to remove the previous formulae,
when the selection changes? Bear in mind not wanting to have Excel with
loads of formulae may be a false economy as it only saves one copy with
references to the range it is in, so it is very efficient anyway...just a
heads up
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


wrote in message
ups.com...
Hi Gurus

I am not a VB programmer but I know where to write code for worksheet
selectionchange.

I want to run a macro on entry in any cell of column "A". in short I
want a row of formulas to be copied for a raneg (B*.AW*). I don't want
memory to be cosumed by keeping the formulas entered by default.


  #3   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 2
Default worksheetselectionchange function to run macro

Eek...sorry a parameter called Target, which is a range object!

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Nick Hodge (MVP)" wrote in message
...
Sudarshan

The SelectionChange event has a parameter called Range. This holds the
address (cell, row or column) of the selected cell, so you can use this to
place the formula (I've used Offset and presumed you are storing the
formulae in the range B1:AW1, although of course you could set the formula
of each cell in the row using the WorksheetFunction property of the
Application object)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
Range("B1:AW1").Copy Destination:=Target.Offset(0, 1)
End If
End Sub

Now the next issue is how you tell Excel to remove the previous formulae,
when the selection changes? Bear in mind not wanting to have Excel with
loads of formulae may be a false economy as it only saves one copy with
references to the range it is in, so it is very efficient anyway...just a
heads up
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


wrote in message
ups.com...
Hi Gurus

I am not a VB programmer but I know where to write code for worksheet
selectionchange.

I want to run a macro on entry in any cell of column "A". in short I
want a row of formulas to be copied for a raneg (B*.AW*). I don't want
memory to be cosumed by keeping the formulas entered by default.



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
Can I write a Macro into an IF Function? FX42N Excel Discussion (Misc queries) 1 June 5th 06 06:06 AM
Adding a Function to a cell when inserting a row from a macro Mbarnes Excel Worksheet Functions 0 May 31st 06 04:38 PM
Restarting a macro BR Excel Worksheet Functions 19 December 23rd 05 09:57 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Function Macro for Nested IF Qaspec Excel Worksheet Functions 5 March 10th 05 07:25 PM


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