PDA

View Full Version : Solved: Non-Contiguous Reference Clear Contents



YellowLabPro
09-12-2007, 08:10 AM
I can get this to work in two lines of code, but w/ the variables I cannot get the syntax right.
Maybe not possible?


.Range("I4:I" & lrwSource, "U4:W" & lrwSource).ClearContents
.Range("I4:I & lrwSource, U4:W" & lrwSource).ClearContents
.Range("I4:I & lrwSource", U4:W" & lrwSource).ClearContents

Curious George....

Bob Phillips
09-12-2007, 09:39 AM
First works fine for me Doug.

YellowLabPro
09-12-2007, 09:44 AM
Bob,
Sorry, small detail left out.
It worked for me too, but it cleared all the contents between the first and last range, not the first and the last range reference.
So where I wanted I4 down and U4:W down cleared. Instead I got I4 through W down cleared.

Bob Phillips
09-12-2007, 09:57 AM
Okay, I thought it was the syantax that was the problem.



.Range("I4:I" & lrwsource & ",U4:W" & lrwsource).ClearContents

YellowLabPro
09-12-2007, 10:13 AM
Thanks again,
I should have tried it, adding the "&". I actually had a fleeting thought about that. I dismissed it several times in my head, I had not seen it and thought it was me again getting inventive.....