If you need to draw a diagonal header directly, you'll need to use the VBA method, and the following is relevant, please continue reading.
With the command button control in the Control Toolbox, draw a command button on the worksheet, change the "Caption" property to "direct slash header", and double-click the button to write code in the "click" Event, where the key code is as follows.
Key code:
' Get row and column headings
Dim Icol, IRow as String
Icol=inputbox ("Please enter row header for slash cell", row heading)
Irow=inputbox ("Please enter column headings for slash cells", column headings)
Selection.value = Icol + "" + IRow
' Judge if the string is in line with the rules
If Len (Icol) = 0 or len (irow) = 0 Then
MsgBox ("The title entered is empty!")
Exit Sub
End If
' Determines whether a selection has only one cell
If selection.count <> 1 Then
MsgBox ("Please select a cell and do this again!")
Exit Sub
End If
' Set the slash on top left to right
With Selection.borders (Xldiagonaldown)
. LineStyle = xlcontinuous
. Weight = Xlthin
. ColorIndex = xlautomatic
End With
This feature is used in the following ways:
Once the code is written, when you need to insert a slash header, select the cell that you want to insert a slash header in (if the selected cell is more than one, the system will give an error prompt, click the "make slash head directly" button, you will be prompted to enter the header row, column headings, respectively, enter the header row headings (such as grades) and column headings (for example, classes).