340 pts.
 How to accept user input and display the value in Excel 2007 macros
I Created an Excel macro that prompts the user to enter two cell numbers. I want to then display a msgbox back showing the cells that were entered. Problem. My msgbox shows the text in my message and instead of showing the values the user entered, it shows 'TRUE'. Any ideas?

Software/Hardware used:
Windows Vista
ASKED: January 28, 2011  4:37 PM
UPDATED: January 28, 2011  8:54 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Can you post your code, please ?

 63,535 pts.

 

Sub FormatData()
Dim VStartRange As Range
Dim VEndRange As Range
Dim VMsg As String


‘ FormatData Macro

‘ Keyboard Shortcut: Ctrl+Shift+F
‘ ‘ new code starts here
‘ prompt user for data ranges
Set VStartRange = Application.InputBox _
(Prompt:=” Enter Starting cell: “, _
Title:=”Identify starting Cell ($x$999)”, _
Default:=Selection.Address, _
Type:=8)
VStartRange.Select

Set VEndRange = Application.InputBox _
(Prompt:=” Enter Last cell:”, _
Title:=”Identify Ending Cell ($x$999)”, _
Default:=Selection.Address, _
Type:=8)
VEndRange.Select

MsgBox ” Starting at ” & vbCrLf _
& VStartRange.Select & ” to ” & VEndRange.Select _
, vbInformation + vbOKOnly, “Data Range Selected”

End Sub

 340 pts.

 

Try changing this:

MsgBox ” Starting at ” & vbCrLf _
& VStartRange.Select & ” to ” & VEndRange.Select _
, vbInformation + vbOKOnly, “Data Range Selected”

To this:

MsgBox " Starting at " & vbCrLf _
& VStartRange.Address & " to " & VEndRange.Address _
, vbInformation + vbOKOnly, "Data Range Selected"
 63,535 pts.