Excel is an excellent application for mathematical operations, but sometimes you just need to organize data in tables that have text labels in every other row. We will walk through different methods to complete this task.
For this tutorial, we will use a data set of “Name”, “Date”, and “Salary”.
Table of Contents
Using Visual Basic for Applications Code to Insert the Same Text in Every Other Row
You must enable the Developer Tab in Excel before inserting the VBA code into the worksheet.
- Tap on File and click on Options toward the bottom of the menu.
- Click Customize Ribbon on the left-hand side.
- Place a check in the box next to Developer in the Main Tabs Category and press the OK button.
- The Developer Tab appears in the Ribbon.
- Tap Visual Basic in the Developer menu to open the Visual Basic for Applications dialog box.
- Tap the Insert menu and select Module.
- In the blank Module window, paste the following code and press Run.
Sub inserttexteveryonerow()
Dim Last As Integer
Dim emptyRow As Integer
Last=Range(“A” & Rows.Count).End(xlUp).Row
For emptyRow=Last to 2 Step -1
If Not Cells(emptyRow,1).Value =”” Then
Rows(emptyRow).Resize(1).Insert
Range(Cells(emptyRow,”A”), Cells(emptyRow, “C”)).Value=Array(“Name”, “Start Date”, “Salary”)
End If
Next emptyRow
End Sub
Important Notes:
- The data in your worksheet must start in cell A1
- Change the text surrounded by quotations of the Array to whatever you want them to be.
- The letters “A” and “C” represent the range of cells where the text appears.
- The text appears in every other row of the worksheet.
Use Keyboard Shortcuts to Insert the Same Text in Every Other Row in Excel
Using keyboard shortcuts is a quick and easy technique to insert the same text in every other row in Excel; however, keyboard shortcuts are time-consuming when dealing with large amounts of data.
- Create blank rows for the new text.
- Select all the blank cells in the column.
- Press F2 on your keyboard to turn on Editing Mode in the last cell of the group. You will see the cursor flashing in the cell.
- Type the text you want in the cell.
- Press CTRL + Enter, and the text appears in the remaining blank cells.
- Repeat these steps for any remaining columns in your worksheet.
Then you can remove the text before or after a character (if present) after.
Use the Fill Handle to Insert the Same Text in Every Other Row in Excel
The Fill Handle in Excel works by copying a pattern that you create and it works to insert the same text in every other row in a worksheet.
- Create your text labels in the worksheet and highlight the row with the labels and the blank row beneath it.
- Place the mouse over the square in the bottom right-hand corner of the selected area, so the cursor turns into a black cross.
- Press the Fill Handle box and drag it down through the rows until you have the desired number of labels.
- Now you can copy the data under the labels.
Conclusion
Now you have a couple of quick, easy ways to insert the same text in every other row of your worksheet. We encourage you to continue learning more Excel tricks from our blog.
This includes adding alternate row colors to make the entries pop out more.