Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, how can I copy the complete content of one cell and add it to the end of
the content in another cell? Example: in one cell I have London, in the next cell I have UK and I want the first cell to be London (UK). Ideally I would like some kind of macro so I can choose the source and destination cells. Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, This would do the trick i think
Sub ConcatenateTwoCells() Src = InputBox("Which cell's content do you want to append to another cell?") Dst = InputBox("To which cell do you want to append the contents of cell " & Src) Range(Dst) = Range(Dst) & Range(Src) End Sub Regards, ManualMan http://www.gamesXL.tk |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your response, Manual Man. This looks like the kind of thing I
need, but I am getting a compile error saying 'expected: expression' - any idea why? Also, is there a way of getting it to put brackets round the added text? (Sorry for my cluelessness!) Many thanks again for your help. "ManualMan" wrote: Hi, This would do the trick i think Sub ConcatenateTwoCells() Src = InputBox("Which cell's content do you want to append to another cell?") Dst = InputBox("To which cell do you want to append the contents of cell " & Src) Range(Dst) = Range(Dst) & Range(Src) End Sub Regards, ManualMan http://www.gamesXL.tk |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ConcatenateTwoCells()
Src = InputBox("Which cell's content do" & _ " you want to append to another cell?") Dst = InputBox("To which cell do you want to " & _ "append the contents of cell " & Src) Range(Dst).Text = Range(Dst).Text & _ " (" & Range(Src).Text & ")" End Sub -- Regards, Tom Ogilvy "Sophisticated Penguin" wrote in message ... Thanks for your response, Manual Man. This looks like the kind of thing I need, but I am getting a compile error saying 'expected: expression' - any idea why? Also, is there a way of getting it to put brackets round the added text? (Sorry for my cluelessness!) Many thanks again for your help. "ManualMan" wrote: Hi, This would do the trick i think Sub ConcatenateTwoCells() Src = InputBox("Which cell's content do you want to append to another cell?") Dst = InputBox("To which cell do you want to append the contents of cell " & Src) Range(Dst) = Range(Dst) & Range(Src) End Sub Regards, ManualMan http://www.gamesXL.tk |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom. The input boxes work fine but the line
Range(Dst).Text = Range(Dst).Text & Range(Src).Text seems to be causing problems. Any ideas? Thanks again to both of you for your help. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works fine for me. It would depend on what you enter in the inputbox.
If you don't put in a valid cell address, it won't work. -- Regards, Tom Ogilvy "Sophisticated Penguin" wrote in message ... Thanks Tom. The input boxes work fine but the line Range(Dst).Text = Range(Dst).Text & Range(Src).Text seems to be causing problems. Any ideas? Thanks again to both of you for your help. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ConcatenateTwoCells()
Set Src = Application.InputBox("Which cell's content do " & _ "you want to append to another cell?", Type:=8) Set Dst = Application.InputBox("To which cell do you want to " & _ "append the contents of cell " & Src.Address, Type:=8) Dst.Value = "(" & Dst.Value & Src.Value & ")" End Sub This uses Application.Inputbox which allows the cells to be mouse selected. -- HTH RP (remove nothere from the email address if mailing direct) "Sophisticated Penguin" wrote in message ... Thanks for your response, Manual Man. This looks like the kind of thing I need, but I am getting a compile error saying 'expected: expression' - any idea why? Also, is there a way of getting it to put brackets round the added text? (Sorry for my cluelessness!) Many thanks again for your help. "ManualMan" wrote: Hi, This would do the trick i think Sub ConcatenateTwoCells() Src = InputBox("Which cell's content do you want to append to another cell?") Dst = InputBox("To which cell do you want to append the contents of cell " & Src) Range(Dst) = Range(Dst) & Range(Src) End Sub Regards, ManualMan http://www.gamesXL.tk |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, I think it was my fault because I didn't put the $ signs before the cell
letter and number. Bob, the application input boxes are very useful. I must try to do some tutorials for VBA - it seems it is possible to do almost anything if only you know how! Thank you all for your patience and help - I'm most grateful. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe the error Sophisticated Penguin mentioned, is caused by two
different (non-text) cell formats. In that case, try to convert your cell.value into a string |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to click on a cell and have the content of the cell display in a different cell | Excel Worksheet Functions | |||
How make hyperlink refer to cell content rather than cell address. | Excel Discussion (Misc queries) | |||
Excel - create button to replace cell content with cell value | Excel Worksheet Functions | |||
Cell Formula reference to cell Based On third Cell Content | Excel Discussion (Misc queries) | |||
Cell Formula reference to cell Based On third Cell Content | Excel Discussion (Misc queries) |