Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Repost: Worksheet Change Method (Bob Philips, Ron De Bruin)


Hi guys, I don't think I explained very cleary what I am
trying to achieve. I would like a range of values in
column C to match the corresponing value in Column D when
the user enters a Value in a cell in Column D.

I can do it with one cell, for example

If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target


but how to you expand this to all of columns D & C ?

Thanks,

Michael


Michael,

Try

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("$D$13:E100")) Is
Nothing Then
With Target.Offset(0, -1)
With .Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
.Font.Bold = True
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

Bob Phillips

"Michael" wrote in message
...

Hi all,

Is it possible to expand the code below to apply it a
range of cells. At present it only works on a single cell
D13 and consequently C13.Is this possible?,

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target
Range("C13").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End Sub

Thanks for your help

Michael



..


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Repost: Worksheet Change Method (Bob Philips, Ron De Bruin)

Try this Michael

It is working for the whole column D

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Target.Offset(0, -1).Value = Target.Value
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Michael" wrote in message ...

Hi guys, I don't think I explained very cleary what I am
trying to achieve. I would like a range of values in
column C to match the corresponing value in Column D when
the user enters a Value in a cell in Column D.

I can do it with one cell, for example

If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target


but how to you expand this to all of columns D & C ?

Thanks,

Michael


Michael,

Try

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("$D$13:E100")) Is
Nothing Then
With Target.Offset(0, -1)
With .Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
.Font.Bold = True
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

Bob Phillips

"Michael" wrote in message
...

Hi all,

Is it possible to expand the code below to apply it a
range of cells. At present it only works on a single cell
D13 and consequently C13.Is this possible?,

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target
Range("C13").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End Sub

Thanks for your help

Michael



.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Repost: Worksheet Change Method (Bob Philips, Ron De Bruin)


Hi Ron, That works perfect !

Thanks,

Michael

-----Original Message-----
Try this Michael

It is working for the whole column D

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Target.Offset(0, -1).Value = Target.Value
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Michael" wrote in message

...

Hi guys, I don't think I explained very cleary what I am
trying to achieve. I would like a range of values in
column C to match the corresponing value in Column D

when
the user enters a Value in a cell in Column D.

I can do it with one cell, for example

If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target


but how to you expand this to all of columns D & C ?

Thanks,

Michael


Michael,

Try

Private Sub Worksheet_Change(ByVal Target As

Excel.Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("$D$13:E100")) Is
Nothing Then
With Target.Offset(0, -1)
With .Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
.Font.Bold = True
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

Bob Phillips

"Michael" wrote in message
...

Hi all,

Is it possible to expand the code below to apply it a
range of cells. At present it only works on a single

cell
D13 and consequently C13.Is this possible?,

Private Sub Worksheet_Change(ByVal Target As

Excel.Range)
If Target.Address < "$D$13" Then Exit Sub
[c13].Value = Target
Range("C13").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End Sub

Thanks for your help

Michael



.




.

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
Worksheet Consolidation - Repost requested Tyro[_2_] Excel Discussion (Misc queries) 3 October 6th 07 09:34 PM
Repost -calculate % change for each phrase. Gwen Excel Worksheet Functions 0 January 3rd 05 05:47 PM
Worksheet Change Method Steve Smallman Excel Programming 0 July 25th 03 02:05 PM
Worksheet Change Method Michael[_10_] Excel Programming 0 July 25th 03 10:24 AM
Worksheet Change Method Don Guillett[_4_] Excel Programming 0 July 24th 03 06:44 PM


All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"