![]() |
Code to cut and paste text from continuous cells to make a document such as a memo or narrative
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 |
Code to cut and paste text from continuous cells to make a documen
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 |
Code to cut and paste text from continuous cells to make a document such as a memo or narrative
On Aug 23, 12:35 pm, Steve G <emailfromandtome-
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 |
Code to cut and paste text from continuous cells to make a document such as a memo or narrative
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 |
Code to cut and paste text from continuous cells to make a document such as a memo or narrative
On Aug 23, 5:58 pm, Steve G
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. |
All times are GMT +1. The time now is 11:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com