use message box to report cell values
Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.
-
-
-
Re: use message box to report cell values
At the moment I have the original search macro as module1, I also have code associated with the user form. If I run the macro , I get the message box: I cannot get the user form report unless I go into VBA, select the user form and use F5 - it then runs perfectly. I guess that I need another module to call the form??
-
Re: use message box to report cell values
Are you talking to me?
-
Re: use message box to report cell values
Please!
-
Re: use message box to report cell values
Quote from IanPeter;613658Please!
?
Have you downloaded the attachment? -
-
Re: use message box to report cell values
According to the thread dummy_trial3 has been downloaded as an attachment.
-
Re: use message box to report cell values
Then what is the problem???
-
Re: use message box to report cell values
OK. Me being stupid again. I thought that when I run the macro test, the results would appear in the form that you had so kindly designed and scripted for me ( very grateful). However the results appear in the message box. I have in the module the sub test and the form carries the script that you wrote. How do I get the routine to bring up the results in the form? Are the scripts in the correct place?
-
Re: use message box to report cell values
Try my last attachment.
It has the command button on Sheet1
-
Re: use message box to report cell values
I am afraid that there was no command button. I am opening it on a Mac using Excel 2011 - is that a problem? I have re-attached the file just in case
-
-
Re: use message box to report cell values
How about
-
Re: use message box to report cell values
Wow,wow and wow!! Thank you so much for all of the help. I will be able to get on with the larger project now. The problem there is getting the data from the pathology system which has fairly few facilities to do what I am trying to achieve.
-
Re: use message box to report cell values
Another question. Is it possible to colour values, say over 20, retrieved from column J using the user form. Simply to highlight values that are 'off scale' in terms of reasonableness
Thank you -
Re: use message box to report cell values
try
Code
Display MorePrivate Sub UserForm_Initialize() Dim r As Range, a() As String, n As Long, myHead, i As Long myHead = [{"Name","Telephone","TChol and Trigs","Req Date"}] For i = 1 To UBound(myHead) With Me.Controls("Label" & i) .ForeColor = vbBlue .Caption = myHead(i) End With Next For Each r In Range("j2", Range("j" & Rows.Count).End(xlUp)) If (r.Value > 10) * (r.Value <> "UNREQ") Then n = n + 1 ReDim Preserve a(1 To 4, 1 To n) a(1, n) = Join$(Array(r(, -5).Value, r(, -6).Value)) a(2, n) = Join$(Array(r(, -3).Value, r(, -2).Value)) a(3, n) = Join$(Array(r(, 0).Value, r(, 1).Value), " ") a(4, n) = Join$(Array(r.Value, r(, -1).Value)) End If Next Me.results.Height = 20 Me.Height = 80 If n > 0 Then With Me.results .Height = n * (.Font.Size + 25) .ColumnCount = 4 .ColumnWidths = "80;120;80;80" .Column = a .MultiSelect = 1 For i = 0 To .ListCount - 1 If Val(Split(.List(i, 2), " ")(1)) >= 20 Then .Selected(i) = True Next End With Me.Height = Me.results.Height + 50 Else Me.results.List = Array("No results") End If End Sub
-
Re: use message box to report cell values
THank you. Works brilliantly. If one just wanted to change the triglyceride value color to red, how would that be coded?
-
-
Re: use message box to report cell values
It is not possible for a ListBox.
-
Re: use message box to report cell values
Time to let this thread lie, IanPeter.
You seem to have a solution to your issue (Essentially what was pointed out to you in your original thread - link in post #1 of this thread)...
Please start a new thread for any questions relating to formatting/displaying your results on the userform.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!