Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Content of Cell clicked in another cell

Hi,

I have the following macro which is not working completely as
required.

I want the macro to look into a range C18 to C45 and push the content
of the cell into C13. Incase any other cell is clicked, the macro
should not perform any action.

However the below macro selects all the cells on the sheet when click
instead of the cells within the C18:C45 range.

Can anyone advise improvement to the below macro

Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("C18:C45")
For Each cell In rng
Range("c13").Value = ActiveCell.Value
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Content of Cell clicked in another cell

Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "c18:c45"
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Range("c13").Value = Target.Value
End With
End If
End Sub


Gord Dibben MS Excel MVP

On Mon, 23 Mar 2009 06:10:37 -0700 (PDT), Sandip
wrote:

Hi,

I have the following macro which is not working completely as
required.

I want the macro to look into a range C18 to C45 and push the content
of the cell into C13. Incase any other cell is clicked, the macro
should not perform any action.

However the below macro selects all the cells on the sheet when click
instead of the cells within the C18:C45 range.

Can anyone advise improvement to the below macro

Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("C18:C45")
For Each cell In rng
Range("c13").Value = ActiveCell.Value
Next
End Sub


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
to had the value show in one cell if a different cell is clicked o Mudman Excel Discussion (Misc queries) 5 March 28th 08 04:48 PM
Change cell value when right-clicked/double-clicked grime[_5_] Excel Programming 5 October 17th 05 01:52 PM
Populating a cell when certain cell is clicked Anthony Slater Excel Discussion (Misc queries) 3 April 14th 05 01:55 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


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