ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Apply Excel Program to a Number of Rows (https://www.excelbanter.com/excel-programming/327863-apply-excel-program-number-rows.html)

Carlton

Apply Excel Program to a Number of Rows
 
Hello all,

With the help of various people from this group I have managed to come
up with an excel program that appears to work for me. However, the
program applies to one row and I need it to work with a number of rows
without having to write out individual cells. Can someone please show
me how to acheive it? I have attached the program below.

Cheers

Carlton

Private Sub Worksheet_Change(ByVal Target As Range)
If Me.Range("A1") Me.Range("E1") And _
Me.Range("B1") Me.Range("F1") And _
Me.Range("C1") Me.Range("G1") Then
MsgBox "Damn it"
End If
End Sub

papou

Apply Excel Program to a Number of Rows
 
Hi
You may use the Target.Row property, ie:
r = Target.Row
Range("A" & r)

HTH
Cordially
Pascal

"Carlton" a écrit dans le message de news:
...
Hello all,

With the help of various people from this group I have managed to come
up with an excel program that appears to work for me. However, the
program applies to one row and I need it to work with a number of rows
without having to write out individual cells. Can someone please show
me how to acheive it? I have attached the program below.

Cheers

Carlton

Private Sub Worksheet_Change(ByVal Target As Range)
If Me.Range("A1") Me.Range("E1") And _
Me.Range("B1") Me.Range("F1") And _
Me.Range("C1") Me.Range("G1") Then
MsgBox "Damn it"
End If
End Sub




Carlton Patterson

Apply Excel Program to a Number of Rows
 
Papou,

Thanks for responding, however I guy called Harald has just solved the
problem for me.

Thanks anyway mate.


Cheers

Carlton

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 01:49 PM.

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