ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to do it on excel? (https://www.excelbanter.com/excel-programming/401265-how-do-excel.html)

Eric

How to do it on excel?
 
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:C1")
If Intersect(r, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
r.Value = Target.Value
Application.EnableEvents = True
End Sub

I would like to target on specific cells rather than range.
Could anyone tell me how to modify Range("A1:C1") into different cells? such
as A13, A67, A100.
Thank everyone for any suggestions
Eric

OssieMac

How to do it on excel?
 
Hi Eric,

Set r = Union(Cells(13, 1), Cells(67, 1), Cells(100, 1))

or

Set r = Union(Range("A13"), Range("A67"), Range("A100"))

or

Set r = Union(Range("A13:A15"), Range("A67:A70"), Range("A100"))

--
Regards,

OssieMac


"Eric" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:C1")
If Intersect(r, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
r.Value = Target.Value
Application.EnableEvents = True
End Sub

I would like to target on specific cells rather than range.
Could anyone tell me how to modify Range("A1:C1") into different cells? such
as A13, A67, A100.
Thank everyone for any suggestions
Eric



All times are GMT +1. The time now is 10:59 AM.

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