Msg Box based on part string

JSAUS

New Member
Joined
Jun 11, 2020
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I need to search column B for any cell (there will be multiple) that contains 'subtotal' in the string of text (there will be 'Subtotal - Section 1', 'Subtotal - Section 2' etc). Then a message box to pop up asking for the Rev Code1 for that subtotal section and for the Rev Code1 the user inputs to be written to the cell offset (0,2) and then another box to write a Rev Code2 into (0,3).

Msg Box.jpg
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Maybe something like this

VBA Code:
Sub findsubtot()

Dim lr As Long
lr = Cells(Rows.Count, 2).End(xlUp).Row

For x = 1 To lr
    If InStr(UCase(Cells(x, 2)), "SUBTOTAL") <> 0 Then
    in1 = InputBox("enter rev code 1 for " & Cells(x, 2).Text)
    Cells(x, 4) = in1
    in1 = InputBox("enter rev code 2 for " & Cells(x, 2).Text)
    Cells(x, 5) = in1
    
    End If

Next x

End Sub
 
Upvote 0
Would there be a way to instead allow the user to select the code from a drop down box?
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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