Input box and 7 msgboxes to correspond to the target range.

rebeila

New Member
Joined
Oct 6, 2023
Messages
17
Office Version
  1. 365
Platform
  1. Windows
input box to the first cell in trget range
msgbox 1 to the second cell
mgbox2 to third and so on.
VBA Code:
Sub Checklist()



Dim currenttime As Date

Dim targetrange As Range





currenttime = Time



If currenttime >= TimeValue("7:00:00") And currenttime <= TimeValue("9:00:00") Then

Set targetrange = Range("F5, D14, D16, D18, D21, D23, D26, D28, D30, D33, D36")

ElseIf currenttime >= TimeValue("9:15:00") And currenttime <= TimeValue("11:30:00") Then

Set targetrange = Range("L5, F14, F16, F18, F21, F23, F26, F28, F30, F33, F36")

ElseIf currenttime >= TimeValue("12:00:00") And currenttime <= TimeValue("14:00:00") Then

Set targetrange = Range("F7, H14, H16, H18, H21, H23, H26, H28, H30, H33, H36")

ElseIf currenttime >= TimeValue("14:15:00") And currenttime <= TimeValue("16:00:00") Then

Set targetrange = Range("L7, J14, J16, J18, J21, J23, J26, J28, J30, J33, J36")

ElseIf currenttime >= TimeValue("16:15:00") And currenttime <= TimeValue("18:00:00") Then

Set targetrange = Range("F9, L14, L16, L18, L21, L23, L26, L28, L30, L33, L36")

ElseIf currenttime >= TimeValue("18:30:00") And currenttime <= TimeValue("21:00:00") Then

Set targetrange = Range("L9, N14, N16, N18, N21, N23, N26, N28, N30, N33, N36")

ElseIf currenttime >= TimeValue("21:30:00") And currenttime <= TimeValue("24:00:00") Then

Set targetrange = Range("F11, P14, P16, P18, P21, P23, P26, P28, P30, P33, P36")

Else

MsgBox "No action to take at this time."

Exit Sub

End If



a = InputBox(" Lead name?")

targetrange = a



Dim response As VbMsgBoxResult

response = MsgBox("Full?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select



response = MsgBox(" full?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select





response = MsgBox("Full?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select







response = MsgBox("Ready?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select







response = MsgBox("5?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select







response = MsgBox(" ON?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select





response = MsgBox("working?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select





response = MsgBox("out?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select





response = MsgBox("filled?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select



response = MsgBox("All good?", vbQuestion + vbYesNoCancel)



Select Case response



Case vbYes

targetrange = "pass"

Case vbNo

targetrange = "fail"

Case vbCancel

targetrange = "N.A"

End Select





End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
input box to the first cell in trget range
msgbox 1 to the second cell
mgbox2 to third and so on.

Your description is too terse for me to be comfortable modifying your code, but in general here is one way to accomplish the above.
VBA Code:
' input box to the first cell in trget range
' msgbox 1 to the second cell
' mgbox2 to third and so on.

Sub Demo()
    Dim targetrange As Range
    Dim response As VbMsgBoxResult
    Dim Answer As Variant, Msg As String
        
    Set targetrange = Range("A1:A50")
    
    'input box
    Answer = InputBox("Enter data")
    If Answer = "" Then
        Exit Sub 'user cancel
    Else
        targetrange.Cells(1, 1).Value = Answer                  'input box to the first cell in trget range
    End If
    
    'msgbox 1
    Msg = "Do you want to proceed"
    response = MsgBox(Msg, vbYesNo + vbQuestion)
    targetrange.Cells(2, 1).Value = response                      'msgbox 1 to the second cell
    
    'mgbox2
    Msg = "Continue or cancel?"
    response = MsgBox(Msg, vbOKCancel + vbQuestion)
    targetrange.Cells(3, 1).Value = response                      'mgbox2 to third and so on.
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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