Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bmj Bmj is offline
external usenet poster
 
Posts: 5
Default Newbie, msgbox

Hi,

I want to display all the values from range H2:H8 in a msgbox, with a
linefeed between the values. How to do this??

Best Regards,
A newbie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie, msgbox


Try:

Sub test()

Dim r As Range
Dim str As String

For Each r In Range("h2:h8")
str = str & r.Value & Chr(13)
Next

MsgBox str
End Sub



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26550

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Newbie, msgbox

Try:

Dim cell As Range
Dim anyS
For Each cell In Range("H2:H8")
If anyS = "" Then
anyS = cell.Value
Else
anyS = anyS & Chr(13) & cell.Value
End If
Next
MsgBox anyS

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Bmj" wrote in message
...
Hi,

I want to display all the values from range H2:H8 in a msgbox, with a
linefeed between the values. How to do this??

Best Regards,
A newbie




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Newbie, msgbox

Remove the IF

Dim cell As Range
Dim anyS
anyS = Range("H2")
For Each cell In Range("H3:H8")
anyS = anyS & vbCrLf & cell.Value
Next
MsgBox anyS

:-)

--

HTH

RP

"Bob Flanagan" wrote in message
...
Try:

Dim cell As Range
Dim anyS
For Each cell In Range("H2:H8")
If anyS = "" Then
anyS = cell.Value
Else
anyS = anyS & Chr(13) & cell.Value
End If
Next
MsgBox anyS

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Bmj" wrote in message
...
Hi,

I want to display all the values from range H2:H8 in a msgbox, with a
linefeed between the values. How to do this??

Best Regards,
A newbie






  #5   Report Post  
Posted to microsoft.public.excel.programming
Bmj Bmj is offline
external usenet poster
 
Posts: 5
Default Newbie, msgbox

Perfecto!!! Thanx :-)))


"Bob Phillips" skrev i melding
...
Remove the IF

Dim cell As Range
Dim anyS
anyS = Range("H2")
For Each cell In Range("H3:H8")
anyS = anyS & vbCrLf & cell.Value
Next
MsgBox anyS

:-)

--

HTH

RP

"Bob Flanagan" wrote in message
...
Try:

Dim cell As Range
Dim anyS
For Each cell In Range("H2:H8")
If anyS = "" Then
anyS = cell.Value
Else
anyS = anyS & Chr(13) & cell.Value
End If
Next
MsgBox anyS

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Bmj" wrote in message
...
Hi,

I want to display all the values from range H2:H8 in a msgbox, with a
linefeed between the values. How to do this??

Best Regards,
A newbie








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox in VBA peyman Excel Discussion (Misc queries) 6 October 6th 07 09:35 PM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
MsgBox shasta[_5_] Excel Programming 4 April 13th 04 01:56 PM
MsgBox Ed Excel Programming 3 November 23rd 03 05:44 PM
Msgbox help JonoB Excel Programming 2 October 27th 03 03:06 PM


All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"