"DO Nothing"

rspalding

Active Member
Joined
Sep 4, 2009
Messages
280
I have code where i want to add make "E12:I12" the active cells but only if it is not the active cells. I'm thinking.

If Range ("E12:I12") .Select = active, then

"Do Nothing"

else Range ("E12:I12") .Select

end if

I tried it and the "do nothing" keeps causing a compile error.

Thanks for the help.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
You could do it like this:

Code:
If Selection.Address<>"$E$12:$I$12" Then Range("E12:I12").Select
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,813
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Why not just Range("E12:I12").Select?
 

rspalding

Active Member
Joined
Sep 4, 2009
Messages
280
Richard,

I tried what you sent and it didn't get me to where my final goal was. After I save my workbook, E12:I12 is the active cell, it closes without asking to save changes. However, if I hit my print button, and then close my workbook, it askes my to save changes. The only change would be if E12:I12 was not the active cell. I'm trying to save 1 step as I'm doing this many times per day.

Robert
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,505
Messages
5,837,737
Members
430,514
Latest member
Stanislav546564

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
Top