shorter way of writing things

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
294
G'day all,
can i replace
Code:
Range("c10").Select: ActiveCell = ""
with
Code:
Range("c10").value = ""
I think the answer is yes , but I'm not sure
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I'd like to elaborate a little bit on VoG's very short and totally correct answer :)

The answer is (imho) not so much that you can do it like that, but that you should do it like that. In almost all cases, there is no need for the .Select code that often originates from recording stuff.
Performance and reliability of your code will be much higher without using Select.

Just my 2 cents :biggrin:
 
Upvote 0
thanks Hermanito

does it really affect performance that much, I have created this code by recording , plagiarising , and asking for modifications, so far it has worked

I thought what you said was the case
 
Upvote 0
Thanks Peter, I had a cusory glance at it, I will definately read it when I get home, as you said it looks like what I need
 
Upvote 0
if you are only working with a few cells, you won't notice a big difference in performance, but if you need to work with larger ranges (thousands or tens of thousands of cells), you will definitely see a very big difference, especially if you need to loop through the range cell per cell and perform some actions or checks...
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top