Entire Column - Dave Peterson

  • Thread starter Thread starter Zone
  • Start date Start date
Z

Zone

There it is again! Dave, in your reply to Darin, you used

.Range(.Columns(NextCol), .Columns(.Columns.Count)).EntireColumn.Delete

I can find no difference between this and

.Range(.Columns(NextCol), .Columns(.Columns.Count)).Delete

I can see that under some coding circumstances, failing to include
EntireColumn could cause a problem. But I wonder whether you include
EntireColumn here as a fail-safe, or out of force of habit, or did I miss
something?

Thanks,
James
 
It's a personal choice--more than habit, less than required.

I find that reading:

..range(...).entirecolumn.something

Documents itself better for me. I don't have to look at what's inside the
..range() portion to see that I want the entirecolumn.

If I used
activesheet.columns(1).delete
I wouldn't have used .entirecolumn.
 
Hi James, I am looking at the Range(.Columns(NextCol),
..Columns(.Columns.Count)) and thinking that might be either a single cell or
a horizontal range in which case if the .EntireColumn property wasn't
included, then only the portion called out by the Range reference would be
deleted. I do not see the Range reference as being equivalent to the
statement that includes .EntireColumn.
 
I see exactly what you're saying. My main concern is not to give bad advice
in here. If I'm absolutely sure I'm working with columns (or rows), I'm not
going to worry about including the Entire part. If I'm not 100% sure, I'll
include it. And, of course, always including it does no harm and covers the
odd unforeseen situation. As always, thank you for lending your expertise
to the newsgroup. James
 
Whiz,
Aha! I didn't think of that. It does get kinda squishy when considering
the ramifications of range. So, it's better to include the "Entire" part as
a matter of course. Gosh, I love this place! James
 
Oh, I wouldn't worry too much about giving wrong advice. There'll be enough
followups to set you straight <vbg>.

But if you're unsure, you can just state that in your message.

I use "This worked for me" a lot! Sometimes, I'm not sure if my code does what
the OP needed--sometimes, I'm not sure if my data was an accurate representation
of the OP's data.
 
Back
Top