PC Review


Reply
Thread Tools Rate Thread

Code to cut and paste text from continuous cells to make a document such as a memo or narrative

 
 
Steve G
Guest
Posts: n/a
 
      23rd Aug 2007
Frequently I have text in various cells in Excel. For instance, A1,
A2, A3 might have text only in these cell. There might be a different
sentence in each cell. I would like to cut the text from A2 and A3 in
that order and append it to the text in A1 without doing cuts and
pastes. The cells would always be contiguous as in my example.
Better yet, if there was a wizard that let me name the cells from
which I want to take text out of and the cell that I want to paste
text into, that would be best.

Thank you.

Steve G

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      23rd Aug 2007
Is something like this whatt you are looking for?

Sub cutandpaste()

OldCell = InputBox("Enter Cell to copy")
NewCell = InputBox("Enter Cell to Paste")

Range(NewCell).Value = Range(NewCell).Value & Range(OldCell).Value

End Sub


"Steve G" wrote:

> Frequently I have text in various cells in Excel. For instance, A1,
> A2, A3 might have text only in these cell. There might be a different
> sentence in each cell. I would like to cut the text from A2 and A3 in
> that order and append it to the text in A1 without doing cuts and
> pastes. The cells would always be contiguous as in my example.
> Better yet, if there was a wizard that let me name the cells from
> which I want to take text out of and the cell that I want to paste
> text into, that would be best.
>
> Thank you.
>
> Steve G
>
>

 
Reply With Quote
 
Ferris
Guest
Posts: n/a
 
      24th Aug 2007
On Aug 23, 12:35 pm, Steve G <emailfromandtome-
softwareus...@yahoo.com> wrote:
> Frequently I have text in various cells in Excel. For instance, A1,
> A2, A3 might have text only in these cell. There might be a different
> sentence in each cell. I would like to cut the text from A2 and A3 in
> that order and append it to the text in A1 without doing cuts and
> pastes. The cells would always be contiguous as in my example.
> Better yet, if there was a wizard that let me name the cells from
> which I want to take text out of and the cell that I want to paste
> text into, that would be best.
>
> Thank you.
>
> Steve G


If you select the cells in the order you want them, then this should
work. It will prompt you for the destination cell.

Sub test()
Dim rng As Range, rngPaste As Range

Set rng = Selection
Text = ""
For Each c In rng
Text = Text & c.Value
Next
Set rngPaste = Application.InputBox _
(Prompt:="Please select the destination cell", Type:=8)

If Not rngPaste Is Nothing Then
rngPaste.Value = Text
End If

End Sub

 
Reply With Quote
 
Steve G
Guest
Posts: n/a
 
      24th Aug 2007
Ferris--

Does it work like this:

I put the macro in my personal.xls. I open the file with the text.
Do I highlight/select the cells I want to transfer the text from?
Then I run the macro. The macro asks me for input. I type in C5 or
D7 or whatever cell I want the text to go into. I hit "enter."

Thank you for your assistance.

Steve G

 
Reply With Quote
 
Ferris
Guest
Posts: n/a
 
      24th Aug 2007
On Aug 23, 5:58 pm, Steve G <emailfromandtome-softwareus...@yahoo.com>
wrote:
> Ferris--
>
> Does it work like this:
>
> I put the macro in my personal.xls. I open the file with the text.
> Do I highlight/select the cells I want to transfer the text from?
> Then I run the macro. The macro asks me for input. I type in C5 or
> D7 or whatever cell I want the text to go into. I hit "enter."
>
> Thank you for your assistance.
>
> Steve G


Yeah, it should work pretty much like that. If you have Excel 2003 or
earlier I'd throw a button on the toolbar to make it accessible. You
don't have to type in the cell reference, you should be able to click
anywhere on the sheet and the cell reference should appear in the
input box.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Can't paste text in memo text box on subform Douglas J. Steele Microsoft Access Form Coding 0 24th Aug 2009 07:02 PM
Narrative in cells Jane Microsoft Excel Misc 1 23rd Jan 2005 04:45 PM
Access XP: how do i get a text document into a memo field =?Utf-8?B?RHdpZ2h0?= Microsoft Access External Data 6 8th Oct 2004 01:59 PM
Access XP: how do i get a text document into a memo field =?Utf-8?B?RHdpZ2h0IEh1ZmZtYW4=?= Microsoft Access External Data 0 5th Oct 2004 08:41 PM
Cannot cut and paste trademark (TM) symbol into Access text or memo field Alicia Microsoft Access 1 9th Jul 2003 12:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:55 PM.