ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range Usage (https://www.excelbanter.com/excel-programming/399664-range-usage.html)

Rick

Range Usage
 
I need to be able to adjust the ending cell range in this example by using a
formula,for when I do an insert rows, the K76 will become K86 or anyother
number.What are my options and how do I construct this statement so that I
will not have to touch is statement again.

If Not Application.Intersect(Target, Me.Range("K4:K76")) Is Nothing Then

Rick Rothstein \(MVP - VB\)

Range Usage
 
I need to be able to adjust the ending cell range in this example by using
a
formula,for when I do an insert rows, the K76 will become K86 or anyother
number.What are my options and how do I construct this statement so that I
will not have to touch is statement again.

If Not Application.Intersect(Target, Me.Range("K4:K76")) Is Nothing Then


Put the 76 or 86 or whatever into a String variable and concatenate it into
the range text...

Dim ColNumber As String
.....
.....
ColNumber = "86"
.....
.....
If Not Application.Intersect(Target, Me.Range("K4:K" & ColNumber)) Is
Nothing Then
.....
.....

Rick


Rick

Range Usage
 
Thanks will give it a try.

"Rick Rothstein (MVP - VB)" wrote:

I need to be able to adjust the ending cell range in this example by using
a
formula,for when I do an insert rows, the K76 will become K86 or anyother
number.What are my options and how do I construct this statement so that I
will not have to touch is statement again.

If Not Application.Intersect(Target, Me.Range("K4:K76")) Is Nothing Then


Put the 76 or 86 or whatever into a String variable and concatenate it into
the range text...

Dim ColNumber As String
.....
.....
ColNumber = "86"
.....
.....
If Not Application.Intersect(Target, Me.Range("K4:K" & ColNumber)) Is
Nothing Then
.....
.....

Rick




All times are GMT +1. The time now is 05:18 PM.

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