Question:
How can I get Excel to fill in blanks with specific information?
1970-01-01 00:00:00 UTC
How can I get Excel to fill in blanks with specific information?
Four answers:
Nahum
2013-02-09 23:47:42 UTC
The Ctrl+D shortcut works in two ways:

- Selecting a range and pressing Ctrl+D will copy the values (or formulas) in the first row to all other rows in the selection.

- Selecting a single cell and pressing Ctrl+D will copy whatever is immediately above it.



You might want to reconsider how this workbook is created. You can create a "boilerplate" document that simply has "link" formulas (as Chris D suggests) in appropriate cells, saving the document as an 'Excel template' so copies can be saved without the risk of saving over the document.



With some setup work, you could also use External links to carry data into the sheet, with lookup formulas that make use of a given date or other identifying info. Daily copying and pasting should generally be avoided, because sooner or later someone is going to break the sheet.



It seems like you're doing so much work simply because this old sheet "just works", although it doesn't work well. Don't be afraid to look into ways to improve your workflow. I once had a job that required daily transfers of records via email and web form reports. We cut the paperwork down from many hours to one, although I still feel it would have been much better (for accuracy and labor costs) for the system itself to just send the data where it needed to go, than for people to transcribe it.
garbo7441
2013-02-09 20:06:18 UTC
Here is one way to fill the blank rows simply by double clicking any cell. This assumes that the only columns you wish to fill with the data above are blank columns in columns A:D and K:L.



Copy the following event handler to the clipboard (highlight the entire code, right click inside the highlighted area, and 'Copy'):



Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _

Cancel As Boolean)

Dim rng As Range, i, LastRow

LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row

For i = 1 To LastRow - 1

If Cells(i, "A").Value <> "" And Cells(i + 1, "A") = "" Then

ActiveSheet.Range("A" & i & ":" & "D" & i).Copy Destination:= _

ActiveSheet.Range("A" & i + 1 & ":" & "D" & i + 1)

ActiveSheet.Range("K" & i & ":" & "L" & i).Copy Destination:= _

ActiveSheet.Range("K" & i + 1 & ":" & "L" & i + 1)

End If

Next

Target.Offset(0, 1).Select

End Sub



Select the worksheet containing your data and RIGHT click the sheet tab at the bottom.



Select 'View Code' at the bottom of the options offered.



Paste the event handler into the white editing area to the right (right click inside the area and 'Paste').



Close the VBE (red button w/white 'x' - top right)



Double click any cell to fill the blank rows as specified in your question.



--------------------



Supplemental Shortcuts - From selected cell to end of data in active column or row:



B9 to end of data in column B = Select B9 and press: CTRL+SHIFT+ Down Arrow Key



B9 to Y9 = Select B9 to Y9 and press: CTRL+SHIFT+ Down Arrow Key



Not aware of a single keyboard shortcut to autofill a formula down through a populated range of cells in a different column.



However, you can use a macro with your own keyboard shortcut. Here is a macro that will allow you to set a formula in the first cell in the column you wish to autofill the formula, and fill the formula down through the last populated cell in the column you will select when the macro is called.



Copy this macro to the clipboard (highlight the entire code, right click inside the highlighted area, and 'Copy'):



Sub Spl_Autofill()

Dim i, LastRow, selCol

selCol = InputBox("Enter the column letter that the formula applies to.", _

"Column Letter")

If IsNumeric(selCol) Then

MsgBox "The entry must be alphanumeric, not numeric.", vbExclamation, _

"Invalid Entry"

Exit Sub

End If

LastRow = ActiveSheet.Range(selCol & Rows.Count).End(xlUp).Row

actCol = Chr(ActiveCell.Column + 64)

Range(ActiveCell.Address).Select

Selection.AutoFill Destination:=Range(ActiveCell.Address & ":" & _

actCol & LastRow), Type:=xlFillValues

Range(ActiveCell.Address & ":" & actCol & LastRow).Select

Range(ActiveCell.Address).Select

End Sub



Press ALT + F11 (Function Key F11)



In the menus at the top of the VBE, select INSERT MODULE



Paste the macro into the white editing area to the right (right click in the area and 'Paste').



Close the VBE (red button w/white 'x' - top right)



Press ALT + F8 (Function Key F8)



When the Macros window opens, select the macro and click 'Options...' at the bottom.



Enter a letter to be used as a keyboard shortcut for this macro. To select an upper case letter, press the Shift key while selecting your letter.



Click 'OK'



To autofill a formula, enter the formula in the column and first row that you want the formula to appear.



Select any other cell, then select the 'formula' cell again.



Press CTRL + your shortcut letter (CTRL + SHIFT + your shortcut letter, if a capital letter). Enter the column letter of any column referred to in the original formula. Click 'OK'.
Chris D
2013-02-09 14:27:03 UTC
That sounds horrible!



You could paste a relative fomula. Start in the first blank cell (B55, for example) and instead of copying from B54, enter =B54 in the cell. Then hit Ctrl/C to copy that cell and use Ctrl/V to paste it in every other blank cell.



Actually, if you're sorting afterwards this is going to fail, so you'd possibly have to select the entire range and do a Edit > Copy (Ctrl/C) followed by a Paste special ... Values to solidify the fomulae.
fathermartin121
2013-02-10 01:50:10 UTC
Good Question. To fill blanks with the cell above them do this"

Select all columns containing blanks.

On the find tab choose go to special.

Choose Blanks, OK

Enter =, up arrow (not the text, hit the up arrow on the keyboard)

Control Enter.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...