0

I am trying to yield a message box that a user can copy text from. This message box should contain two last row cell values as follows:

     -MsgBox-
'First Value: xxxx'
'Second Value: xxxx'

I have the following vba to find the last cell number:

Dim Lastrow As String
Lastrow = sumsht.Cells(Rows.Count, 1).End(xlUp).Row

I am wanting to output the last cell S and T values to a message box that a user can copy text from. The below is not correct, although it gives you an idea of what I am trying to do.

MsgBox.Range(("S" & Lastrow), ("T" & Lastrow))

EDIT: I should mention that my last 'T' cell contains a formula. I am trying to populate the box with the value the formula yields.

EDIT2: This is different to this question as I want the user to be able to actually select the text from the box itself. Also I couldn't decipher how to actually create the input box in my context (sorry, I am a beginner).

Community
  • 1
  • 1
Heisenberg
  • 267
  • 3
  • 6
  • 15
  • 2
    possible duplicate of [Selectable Text in VBA Message Box](http://stackoverflow.com/questions/12188769/selectable-text-in-vba-message-box) –  Aug 21 '15 at 05:27
  • You should show evidence about your input and output by adding some picture. – R.Katnaan Aug 21 '15 at 07:26

1 Answers1

0

Try as follow:

Dim Lastrow As String
Lastrow = sumsht.Cells(Rows.Count, 1).End(xlUp).Row

Call MsgBox("First Value: " & sumsht.Range("S" & Lastrow) & vbNewLine & "Second Value: " & sumsht.Range("T" & Lastrow))
R.Katnaan
  • 2,486
  • 4
  • 24
  • 36
  • your solution works but still doesn't allow the user to highlight and copy the text. Also the 'T' cell value is not populating into the MsgBox, I believe this may be due to the fact that the 'T' cell contains a formula. I want to return the value that the formula yields in the MsgBox. – Heisenberg Aug 21 '15 at 06:52
  • I did, and edited my question. Thanks for your help! – Heisenberg Aug 21 '15 at 07:06