"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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

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
36,729
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
 

Watch MrExcel Video

Forum statistics

Threads
1,130,047
Messages
5,639,766
Members
417,109
Latest member
996

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