ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Columns in Columns Property? (https://www.excelbanter.com/excel-programming/383432-multiple-columns-columns-property.html)

Don Wiss

Multiple Columns in Columns Property?
 
This line of code works. But can't I combine the range into one covering
columns 2 to 4?

If Intersect(Union(Range("LOBInput").Columns(2), Range("LOBInput").Columns(3), Range("LOBInput").Columns(3)), Target) IsNothing Then

Don <www.donwiss.com (e-mail link at home page bottom).

Dave Peterson

Multiple Columns in Columns Property?
 
maybe...

if intersect(me.range("lobinput").columns(2).resize(, 3), target) is nothing then



Don Wiss wrote:

This line of code works. But can't I combine the range into one covering
columns 2 to 4?

If Intersect(Union(Range("LOBInput").Columns(2), Range("LOBInput").Columns(3), Range("LOBInput").Columns(3)), Target) IsNothing Then

Don <www.donwiss.com (e-mail link at home page bottom).


--

Dave Peterson

JMB

Multiple Columns in Columns Property?
 
Not as nice as Dave's, but just to throw out another possible approach:

Sub test()
With Range("LobInput")
If Interesect(.Range("B1:D" & .Rows.Count), Target) Is Nothing Then
'......
End If
End With
End Sub


"Don Wiss" wrote:

This line of code works. But can't I combine the range into one covering
columns 2 to 4?

If Intersect(Union(Range("LOBInput").Columns(2), Range("LOBInput").Columns(3), Range("LOBInput").Columns(3)), Target) IsNothing Then

Don <www.donwiss.com (e-mail link at home page bottom).



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

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