VBA - Input Box prompt upon finding a blank cell

AM2014

New Member
Joined
Oct 17, 2014
Messages
34
Hi,
<o:p></o:p>
I am struggling to create a VBA code that prompts user input via an input box upon finding a blank cell in Column O, then continueing onto the next blank cell in Column O, again prompting an input box, then finishing when there are no further blank cells in the column. Also, I need to be able to see the cells adjacent to the blank cell in order to know what the input should be.


This post is similar to what I have been looking for, but doesn't exactly get the job done:

http://www.mrexcel.com/forum/excel-...cations-input-box-result-next-empty-cell.html

Thanks for any help!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the board.
Play around w/ this:
Code:
Sub AM2014()
    Dim c As Range
    Dim LastRow As Long, i As Long
    Dim InputReply As Variant
    Dim InputMsg As String, SkipReply As String

    LastRow = Cells(Rows.Count, "N").End(xlUp).Row
    If Cells(Rows.Count, "P").End(xlUp) > LastRow Then
        LastRow = Cells(Rows.Count, "P").End(xlUp).Row
    End If
        
    For i = 1 To LastRow
        Set c = Cells(i, "O")
        If c = "" Then
            InputMsg = "[ " & c.Offset(, -1) & " ] ->    " & _
                "Enter value for: Col O  Row " & i & _
                "    <-[ " & c.Offset(, 1) & " ] "
                
            InputReply = InputBox(InputMsg)
            If InputReply = "" Then
                SkipReply = MsgBox("Skip Row " & i & " ?   (Cancel to abort)", _
                    vbYesNoCancel + vbDefaultButton2, "CONFIRM")
                If SkipReply = vbNo Then
                    i = i - 1
                ElseIf SkipReply = vbCancel Then
                    Exit Sub
                End If
            Else
                c = InputReply
            End If
        End If
    Next i
End Sub
 
Upvote 0
The code works perfectly with one little problem, I can't view the cell where I need to input my number. This is the most important part because otherwise I would have no clue what to input.

I did also notice that the blank cells are automatically entered with two spaces (" "), so I did enter spaces into these two lines:
If c = " " Then
If InputReply = " " Then

This code is a little advanced for me, so any further insight would be helpful. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top