如何锁定工作表位置以使其始终在Excel工作簿中可见?
如果工作簿中有多个工作表,则切换到最后一个工作表时,第一个工作表将隐藏在工作表选项卡栏中,如下所示。 现在,您希望将母版表的位置锁定为始终可见,那么如何处理呢?
用VBA锁定纸张位置
用VBA锁定纸张位置
在这里,我介绍了两个VBA代码供您处理这项工作。
跳到工作表
1。 按 Alt + F11键 启用 Windows的Microsoft Visual Basic.
2。 点击 插页 > 模块,然后将以下代码复制并粘贴到脚本中。
VBA:跳转到母版表
Sub GoToSheet()
UpdatebyExtendoffice20180427
Sheets("Master").Activate
End Sub
Note: In the code slice of Sheets("Master").Activate, you can change the Master to any sheet name as you need.
3. Then save this code, and go back to the workbook, click Developer > Macros.
4. In the Macro dialog, select the code name you inserted just now, click Options, create a shortcut for running this code.
5. Click OK and close the Macro dialog.
From right now, while you pressing the shortcut you created, the master sheet has been activated whichever sheet you use.
Keep the sheet always in the front
1. Press Alt + F11 keys to enable the Microsoft Visual Basic for Windows.
2. Double click ThisWorkbook from the Project-VBAProject pane, and copy and paste below code to the script.
VBA: Keep sheet always in the front
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
UpdatebyExtendoffice2018027
Dim xSheet As Worksheet
Application.EnableEvents = False
Set xSheet = Sheets("master")
If Sh.Name <> xSheet.Name Then
Sh.Move , xSheet
xSheet.Activate
Sh.Activate
End If
Application.EnableEvents = True
End Sub
3. Save the code and close the VBA window. From now, whichever sheet you click, the master sheet always stay in the front of the tab bar.
Note: In above code, “master” is the sheet name you want to keep visible, change it as you need.
Best Office Productivity Tools
Transform Hours into Minutes with Kutools for Excel!
Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed!
Why You Need Kutools for Excel
🛠️ Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios.
📈 Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat!
⏱️ Efficient Batch Operations: Why put in extra effort when you can work smart? Import, export, com
bine, and tweak data in bulk with ease.
📊 Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story.
🗄️ Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites.
📝 Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types.
🎓 User-Friendly: A breeze for beginners and a powerful tool for experts.
Download Now and Soar Through Time with Excel!
Read More... Free Download... Purchase...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
Open and create multiple documents in new tabs of the same window, rather than in new windows.
Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Read More... Free Download... Purchase...