VBA find next blank, display value from another cell in the same row, input value in blank

DWriter9

New Member
Joined
Sep 25, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I have searched everywhere for this topic, but could not find anything and I am starting to think it is impossible.

Basically, I want that the code finds the next blank in column F. Upon that, a msgbox should pop up with the text value of column C of the same row that the code found the next blank.
Now, here is the tricky part, the text value of the column C on the msg box, should be able for the user to copy, the user will then paste this value on another system, which will tell him the result.
The user will come back to excels msgbox and click the correct result (A,B or None), finally code will input A or B in the found blank cell.
But if the user clicks None, the whole row should be deleted.
And so one, until there are no more blank cells in F, of course not counting the end blank cell.

The copy part is really bothering me, I am not sure if there is a way, maybe combination of Input and msg box.

Thank you in advance

1695636942065.png
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Make a userform like this:
1695730620451.png


Paste this code in userform:
VBA Code:
Private Sub CommandButton1_Click()
  Worksheets("Sheet1").writeValue (CommandButton1.Caption)
End Sub
Private Sub CommandButton2_Click()
  Worksheets("Sheet1").writeValue (CommandButton2.Caption)
End Sub
Private Sub CommandButton3_Click()
  Worksheets("Sheet1").deleteRow
End Sub
Private Sub UserForm_Initialize()
  Me.TextBox1.Locked = True
End Sub

Paste this code to Sheet1:
VBA Code:
Public i As Long
Sub Test()
  Dim lRow As Long
  lRow = Cells(Rows.Count, "C").End(xlUp).Row
  For i = lRow To 1 Step -1
    If IsEmpty(Cells(i, "F")) Then
      UserForm1.TextBox1.Value = Cells(i, "C").Value
      UserForm1.Show
    End If
  Next
End Sub
Public Sub writeValue(buttonValue As String)
  Cells(i, "F").Value = buttonValue
End Sub
Public Sub deleteRow()
  Rows(i).EntireRow.Delete
End Sub
 
Upvote 0
EDIT:
Sheet1
VBA Code:
Public i As Long
Sub Test()
  Dim lRow As Long
  lRow = Cells(Rows.Count, "C").End(xlUp).Row
  For i = lRow To 1 Step -1
    If IsEmpty(Cells(i, "F")) Then
      UserForm1.TextBox1.Value = Cells(i, "C").Value
      UserForm1.Show
    End If
  Next
End Sub
Public Sub writeValue(buttonValue As String)
  Cells(i, "F").Value = buttonValue
  UserForm1.Hide
End Sub
Public Sub deleteRow()
  Rows(i).EntireRow.Delete
  UserForm1.Hide
End Sub
 
Upvote 0
Solution
You are absolutely amazing, exactly what I was looking for, even better.
Works like a charm.

Thank you
 
Upvote 0

Forum statistics

Threads
1,223,947
Messages
6,175,562
Members
452,652
Latest member
eduedu

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