LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default modification of Per Jessen Macro- paste/overwrite

Hi Per,
I have found an item within your last macro to me that I'd like to modify.

What I'd like to do is to have a chr(10) inserted between each of the
original elements.

What I've tried thus far has resulted in either the placement of the chr(10)
before, or after the text strings, but not in the middle of.

How do I get it to place the chr(10) in between each line of the original
contents?

'---------------------------------------------
For cell = 1 To myRng.Cells.Count
NewString = NewString & myRng.Cells(cell, 1).Value & " "
myRng.Cells(cell, 1).ClearContents
Next
'-----------------------------------
I've tried placing the chr(10) before the NewString, before the
myRng.cells(cell,1).Value, and then before the two double quotes.
If I place it before the NewString after the = sign, it inserts as many rows
as are merged. Which makes sense.
if I place it before the myRng.cells()..... if places a single row above the
initial text,
and then it does as I want-- a chr(10) at the end of each subsequent row.
How can I get it to skip the insertion to the first row, and only do
subsequent
rows?
Best.
Thank you.

'--------------------------------------------
Dim myRng ' As Range
Dim NewString As String

Sub steven()

Set myRng = Nothing
On Error Resume Next
InputRange:
Set myRng = Application.InputBox(prompt:="Select cells to concatenate",
Type:=8)
If myRng Is Nothing Then End

If myRng.Cells.Count 5 Then
msg = MsgBox("Invalid range selection" & vbLf & vbLf & "Please try
again", vbExclamation, "Regards, Per Jessen")
GoTo InputRange
End If

For cell = 1 To myRng.Cells.Count
NewString = NewString & myRng.Cells(cell, 1).Value & " "
myRng.Cells(cell, 1).ClearContents
Next

myRng.Cells(1, 1) = NewString
myRng.MergeCells = True

End Sub


 
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
Prevent PivotTable Overwrite Warning and Disallow Overwrite jonahviakeyboard Excel Programming 0 November 27th 07 05:08 PM
How to paste blanks only without overwrite exist cells in excel li Excel Discussion (Misc queries) 1 May 30th 07 12:43 PM
Sub to copy a target sheet from slaves from and paste/overwrite into master Max Excel Programming 19 June 14th 05 02:22 AM
Macro modification HJ Excel Programming 6 November 3rd 04 07:37 PM
Need Macro Modification Phil Hageman[_3_] Excel Programming 2 June 2nd 04 12:26 PM


All times are GMT +1. The time now is 03:41 PM.

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

About Us

"It's about Microsoft Excel"