Hot search terms: 360 Security Guard Office365 360 browser WPS Office iQiyi Huawei Cloud Market Tencent Cloud Store
Office software Storage: 102MB Time: 2020-05-28
Software introduction: WPS is WPS Office, which is produced and released by Kingsoft Software. It can realize various functions such as text, tables, presentations and so on commonly used in office software. Memory...
Suppose you need to enter the following content. Since there is no connection function, you have to enter repeated characters repeatedly, which undoubtedly reduces work efficiency.
Customer address
Dongguan City, Guangdong Province Quanxing Co., Ltd.
Dongguan Hongyun Co., Ltd., Guangdong Province
Dongguan Zhongtian Co., Ltd., Guangdong Province
Dongguan City, Guangdong Province Yuemanlou Co., Ltd.
Xingyousheng Co., Ltd., Dongguan City, Guangdong Province
Solution ideas:
Use VBA to add a "Paste Special - Connect" function to WPS Form 2005, and place it in the right-click menu for easy calling.
Step 1. Create a macro for the "Paste Special - Connect" function
This example assumes that your WPS already has a VBA environment;
1. Create a new workbook;
2. Use the shortcut key ALT+F11 to open the VBE environment;
3. Click the menu [Insert] [Module] and enter the following code in the module:
Sub Paste Special__Connection() DimrngAsString,NewShtAsString,OldShtAsString,texts,iAsByte,ansAsByte IfActiveSheet.ProtectContentsThenMsgBox"The worksheet has been protected, this program refuses to execute!",64,"Prompt":ExitSub OnErrorGoToendd rng=Selection.Address OldSht =ActiveSheet.Name Application.DisplayAlerts=False Worksheets.Add NemSht=ActiveSheet.Name Range("a1").Select ActiveSheet.Paste IfActiveSheet.UsedRange.Count>1Then MsgBox"Only the value of a single cell can be connected.",64, "andysky" GoToendd EndIf texts=Selection.Text Application.ScreenUpdating=True Sheets(OldSht).Select ans=InputBox("Please choose to connect before the target or after the target."&Chr(10)&"1: Connect to the target Before;"_ &Chr(10)&"2: Connect after the target. ","Connection method",1) Fori=1ToSelection.Count If--ans=1ThenSelection(i)=textsSelection(i) If--ans= 2ThenSelection(i)=Selection(i)texts Next endd: Worksheets(NemSht).Delete EndSub
Step 2. Add the macro function to the right-click menu
1. Use the shortcut key CTLR+R to open the "Project Explorer", find "ThisWorkbook" in the left pane and double-click it;
2. Enter the code in the code window on the right (two pieces of code: the first is to add the tool to the right-click menu, and the other is to restore the right-click when closing EXCEL):
PrivateSubWorkbook_Open() WithApplication.CommandBars("cell").Controls.Add(Type:=msoControlButton,before:=4,Temporary:=True) .Caption="Paste Special__Connection(&Paste)" .OnAction="Select Paste__Connection" EndWith EndSub PrivateSubWorkbook_BeforeClose(CancelAsBoolean) Application.CommandBars("CELL").Reset EndSub
Step 3. Save the workbook as default template
1. Close the VBE window and return to the worksheet;
2. Click the menu [File] [Save As] and select "WPS Form Template File" as the save type.
Step 4. Test the effect 1. Select the menu [File] [Template on this machine] and select the template you just saved in the list;
2. Enter the following data in the worksheet (see Figure 5), then copy A9, then select A2:A7, right-click and select "Paste Special__Connection" in the menu;
3. At this time, the program will pop up a dialog box, see Figure 7. Enter 1 in it to connect to the front. After clicking OK, the final result is shown in Figure 8.
Conclusion: ET supports VBA for secondary development, which makes it more flexible. When the default functions cannot meet our work needs, we might as well use VBA to handle it.
Google Chrome downloads graphic and text operation content of web videos
How to set the computer shutdown timer? -Tutorial on setting up computer shutdown schedule
How to turn off Huawei pure mode? - Tutorial on turning off Huawei pure mode
What do you think of the computer configuration? -Computer configuration view tutorial
What should I do if my Apple phone suddenly goes black and cannot be turned on? -Tutorial on Apple phone suddenly black screen and unable to open
Detailed steps for renaming shape layers in Image Factory
How to exit safe mode on Xiaomi? -How to exit safe mode in Xiaomi
How to use Xiaomi Mobile Assistant? -Xiaomi Mobile Assistant usage tutorial
How to force restart Xiaomi phone? -How to force restart your phone in Xiaomi
How to set the computer shutdown timer? -Tutorial on setting up computer shutdown schedule