Tab or next cell order after VBA triggered

data808

Active Member
Joined
Dec 3, 2010
Messages
353
Office Version
  1. 2019
Platform
  1. Windows
I have a button that runs an auto save feature through VBA. The code will make some changes to the sheet as far as autofill date in cell C1, unprotect/protect sheet, locking a cell, unhiding a row, changing color of the font in a cell, deleting the button, etc... then ultimately naming the file and saving it on a network drive. Everything works great. Except, I notice that after I trigger this, I have the cursor on the first cell A8 to start entering data and once I do and press tab, it will skip back to C1 which is the first unlocked cell in the spreadsheet that was auto filled at the beginning of this button click.

If I click on another cell first (doesn't matter which one) then click on A8, tab will flow to the next cell A9 with no problem. Is there a way to fix this? I have tried adding the VBA line range("A8").select with other cells first in different parts of the code to see if I can simulate me clicking on these cells but it still doesn't work. Please help.

Thanks.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I have a button that runs an auto save feature through VBA. The code will make some changes to the sheet as far as autofill date in cell C1, unprotect/protect sheet, locking a cell, unhiding a row, changing color of the font in a cell, deleting the button, etc... then ultimately naming the file and saving it on a network drive. Everything works great. Except, I notice that after I trigger this, I have the cursor on the first cell A8 to start entering data and once I do and press tab, it will skip back to C1 which is the first unlocked cell in the spreadsheet that was auto filled at the beginning of this button click.

If I click on another cell first (doesn't matter which one) then click on A8, tab will flow to the next cell A9 with no problem. Is there a way to fix this? I have tried adding the VBA line range("A8").select with other cells first in different parts of the code to see if I can simulate me clicking on these cells but it still doesn't work. Please help.

Thanks.
Found solution. The cause of the problem was with this line:

Rows("104:104").Select
Selection.EntireRow.Hidden = False

This would offset the order of the tabbing for cells back to the first unlocked cell of the sheet. To prevent this, I changed it to this:

Rows("104:104").Hidden = False

That basically makes it so it does the change without disrupting the cursor and its order of cells to tab from.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,914
Messages
6,122,211
Members
449,074
Latest member
cancansova

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