Hi,
How do I insert a line break in the VBA message box? (I tried ^p, but does not work).
Besides, it is possible to make a bulleted list in VBA message box? How?
Thanks!
Jiri
Hi,
How do I insert a line break in the VBA message box? (I tried ^p, but does not work).
Besides, it is possible to make a bulleted list in VBA message box? How?
Thanks!
Jiri
Re: Line break in VBA message box (MsgBox)
Thanks Roy, what about the dotted list?
Thanks!
Jiri
Re: Line break in VBA message box (MsgBox)
No built in list but you can create your own.
Sub x()
Dim strMsg As String
strMsg = "Crude bullet list" & vbNewLine & vbnewline
strMsg = strMsg & "• Item 1" & vbNewLine
strMsg = strMsg & "• The dot is CHR(149)" & vbNewLine
strMsg = strMsg & Chr(149) & " Item 3" & vbNewLine
strMsg = strMsg & Chr(149) & " More Items" & vbNewLine
strMsg = strMsg & Chr(149) & " In my list"
MsgBox strMsg, vbInformation
End Sub
Display More
Re: Line break in VBA message box (MsgBox)
I have tweaked the macro "test". i have mad many of your code statements non operable with single apostrophe in the beginning of the line.
now you can try even between 11:00 and 11:30
Sub test()
Dim sttarget, cfind As Range, sttime
Worksheets("Sheet1 (3)").Activate
With Range("B4:B99")
.Clear
.UseStandardHeight = True
End With
sttarget = InputBox("Start Time (Must be 24hr time with Colon eg 01:30, 12:15, 23:45...)")
myRole = InputBox("Job Role")
myJob = InputBox("Job Name")
fttarget = InputBox("Finishing Time (Must be 24hr time with Colon eg 01:30, 12:15, 23:45...)")
sttime = TimeValue(sttarget)
Set cfind1 = Range(Range("A4"), Range("a4").End(xlDown)).Find(what:=sttime, lookat:=xlWhole)
' If Not cfind Is Nothing Then
' cfind.Offset(0, 1).Select
' Do While Not IsEmpty(ActiveCell)
' ActiveCell.Offset(1, 0).Select
' Loop
'
' ActiveCell = sttarget
' ActiveCell.Offset(1, 0).Select
' ActiveCell = myRole
' ActiveCell.Offset(1, 0).Select
' ActiveCell = myJob
' Else
' MsgBox "not available"
If cfind1 Is Nothing Then
MsgBox "not avilable"
Exit Sub
End If
fttime = TimeValue(fttarget)
Set cfind2 = Range(Range("A4"), Range("a4").End(xlDown)).Find(what:=fttime, lookat:=xlWhole)
' If Not cfind Is Nothing Then
' cfind.Offset(0, 1).Select
' Do While Not IsEmpty(ActiveCell)
' ActiveCell.Offset(1, 0).Select
' Loop
'
' ActiveCell.Offset(-1, 0).Select
' ActiveCell = fttarget
' Else
If cfind2 Is Nothing Then
MsgBox "not available"
Exit Sub
End If
'Range(ActiveCell, ActiveCell.Offset(-4, 0)).Merge
Range(cfind1, cfind2).Offset(0, 1).Select
Selection.Clear
Selection.Merge
With Selection
.Value = WorksheetFunction.Text(sttime, "hh:mm") & Chr(10) & myRole & Chr(10) & myJob & Chr(10) & WorksheetFunction.Text(fttarget, "hh:mm")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
'.MergeCells = True
'.Value = WorksheetFunction.Text(sttime, "hh:mm") & Chr(10) & myRole & Chr(10) & myJob & Chr(10) & WorksheetFunction.Text(fttarget, "hh:mm")
.EntireRow.AutoFit
End With
End Sub
Display More
those non operable code statements can be deleted. they have been kept for you to understand.
after you park this modified macro (removing old "est") and save the file.
you again save this file with the code modified by me above in a separate folder and then start deleting the non operable statements and also you want to modify
Don’t have an account yet? Register yourself now and be a part of our community!