You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter VBXL
- Start date

Code:

```
Sub AutoFill()
Dim R&, F%
R = ActiveCell.Row
Do
F = 1
R = R + 1
If IsNumeric IsEmpty(Cells(R, 1)) Then F = 0: Cells(R, 1) = Cells(R - 1, 1)
If IsNumeric IsEmpty(Cells(R, 2)) Then F = 0: Cells(R, 2) = Cells(R - 1, 2) + 1
Else: MsgBox ("The selection is text, this keyboard shortcut will only work with numbers."), vbOKOnly + vbInformation, "Shortcut Information"
Loop Until F
End Sub
```

Code:

```
Sub AutoFill()
Dim R&, F%
R = ActiveCell.Row
Do
F = 1
R = R + 1
If IsNumeric Then
Else: Exit Sub
If IsEmpty(Cells(R, 1)) Then F = 0: Cells(R, 1) = Cells(R - 1, 1)
If IsNumeric And IsEmpty(Cells(R, 2)) Then F = 0: Cells(R, 2) = Cells(R - 1, 2) + 1
Else: MsgBox ("The selection is text, this keyboard shortcut will only work with numbers."), vbOKOnly + vbInformation, "Shortcut Information"
Loop Until F
End Sub
```

Code:

```
Sub AutoFill()
Dim R&, F%
R = ActiveCell.Row
Do
F = 1
R = R + 1
If Not IsNumeric Then
MsgBox ("The selection is text, this keyboard shortcut will only work with numbers."), vbOKOnly + vbInformation, "Shortcut Information"
Exit Sub
End If
Else
If IsEmpty(Cells(R, 1)) Then F = 0: Cells(R, 1) = Cells(R - 1, 1)
If IsEmpty(Cells(R, 2)) Then F = 0: Cells(R, 2) = Cells(R - 1, 2) + 1
Loop Until F
End Sub
```

Code:

```
Sub AutoFill()
Dim R&, F%
R = ActiveCell.Row
Do
F = 1
R = R + 1
If Not IsNumeric(Cells(R, 1)) Then
If Not IsNumeric(Cells(R, 2)) Then
MsgBox ("The selection is text, this keyboard shortcut will only work with numbers."), vbOKOnly + vbInformation, "Shortcut Information"
Exit Sub
End If
If IsEmpty(Cells(R, 1)) Then F = 0: Cells(R, 1) = Cells(R - 1, 1)
If IsEmpty(Cells(R, 2)) Then F = 0: Cells(R, 2) = Cells(R - 1, 2) + 1
Loop Until F
End Sub
```

Code:

```
Sub AutoFill()
Dim R&, F%
R = ActiveCell.Row
If Not IsNumeric(Cells(R, 1)) Then
If Not IsNumeric(Cells(R, 2)) Then
MsgBox ("The selection is text, this keyboard shortcut will only work with numbers."), vbOKOnly + vbInformation, "Shortcut Information"
Exit Sub
End If
End If
Do Until F
F = 1
R = R + 1
If IsEmpty(Cells(R, 1)) Then F = 0: Cells(R, 1) = Cells(R - 1, 1)
If IsEmpty(Cells(R, 2)) Then F = 0: Cells(R, 2) = Cells(R - 1, 2) + 1
Loop
End Sub
```