ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set value for range of cells! (https://www.excelbanter.com/excel-programming/297259-set-value-range-cells.html)

Kim-Anh Tran[_6_]

Set value for range of cells!
 
How do I change this to set target range for rows from 46:54?
I appreciate any help!
Kim-Anh

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 46 And Target.Column = 20 Then
Select Case Target.Formula
Case "x"
'allow this
Case ""
'allow this
Case Else
'reset to nothing
Target.Formula = ""
End Select
End If
End Su

--
Message posted from http://www.ExcelForum.com


Norman Jones

Set value for range of cells!
 
Hi Kim-Anh Tran ,

Try:
If Target.Row 45 And Target.Row < 55 _
And Target.Column = 20 Then
---
Regards,
Norman

"Kim-Anh Tran " wrote in
message ...
How do I change this to set target range for rows from 46:54?
I appreciate any help!
Kim-Anh

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 46 And Target.Column = 20 Then
Select Case Target.Formula
Case "x"
'allow this
Case ""
'allow this
Case Else
'reset to nothing
Target.Formula = ""
End Select
End If
End Sub


---
Message posted from http://www.ExcelForum.com/




Tim Zych[_7_]

Set value for range of cells!
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, _
Range(Cells(46, 20), Cells(54, 20))) Is Nothing Then
'within range
End If
End Sub


"Kim-Anh Tran " wrote in
message ...
How do I change this to set target range for rows from 46:54?
I appreciate any help!
Kim-Anh

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 46 And Target.Column = 20 Then
Select Case Target.Formula
Case "x"
'allow this
Case ""
'allow this
Case Else
'reset to nothing
Target.Formula = ""
End Select
End If
End Sub


---
Message posted from http://www.ExcelForum.com/





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com