Excel selecting strange cells after changing values

Will S

Board Regular
Joined
Oct 29, 2013
Messages
69
This is the strangest thing I've seen excel do in a while, I've got a sheet that I want to know when it was last changed. So I added the code below to an existing On-Change program
When this code is in the macro, whenever I enter a value and press [enter], rather than going to the cell it usually would, it will do one of two things:

1. move down a row as usual but then shoot to the side and select the cell in the B column

2. Move up and select the first cell it could on row 10 that wasn't protected, starting with Row B and then working it's way across.

Code:
  ActiveSheet.Unprotect
Range("B11").Formula = "=TODAY()"
Range("B11").Copy
    Range("B10").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Range("B11").Formula = ""
  Application.EnableEvents = True

I've tried changing things up, protecting the cell it's trying to select. It's definitely the copy/Paste bit it doesn't like. I'm okay with it doing that because having that date only change with that certain sheet is pretty important, is there anyway to go to a previous selected cell or any way of having on change it just types the value of today in like Range... = xlTodayValue (I have no idea if anything like this exists) without the copy/paste?

Any help is appreciated.
Best regards,
~Will S
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Actually, nevermind. Sorted it with:


Set PrevCell = ActiveCell
'other code
PrevCell.SelectIF anyone has any better/move efficient ways of doing it feel free to shout in here, who knows if anyone will ever have a similar issue that this wouldn't apply to.</pre>
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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