Message box that display what is in cells


Posted by Paul on April 16, 2001 1:27 PM

Is it possible to write a macro that displays what is in 3 cells to the right of the active cell in a message box?

Like this if possible.
------------------------------------
| Is this correct. |
| 1st Name: 3rd Cell to right |
| Mid Name: 1st Cell to right |
| Last Name: 2nd Cell to right |
| -------- --------- |
| | OK | | Cancel | |
| -------- --------- |
------------------------------------
Thanks

Posted by David Hawley on April 16, 2001 2:11 PM

Hi Paul

Try this:

Sub CellContents()
'Writtent By OzGrid Business Applications
'www.ozgrid.com
'Displays the contents of the _
1,2 and 3rd cell on right of active cell

Dim S1Right As String
Dim S2Right As String
Dim S3Right As String
Dim Reply As Integer

With ActiveCell
S1Right = .Offset(0, 1)
S2Right = .Offset(0, 2)
S3Right = .Offset(0, 3)
End With

Reply = MsgBox("The 1st to the right is " & S1Right _
& " The 2nd to the right is " & S2Right _
& " The 3rd to the right is " & S3Right _
, vbOKCancel, "OzGrid Business Applications")

If Reply = vbCancel Then Exit Sub

'Do the below if not Canceled
'More Code Here!
End Sub


Dave

OzGrid Business Applications



Posted by Paul on April 16, 2001 2:23 PM

Thanks

Thanks