Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ...
Some months ago I posted a question here, and someone was kind enough to show me how to write the code to do what I needed. Unfortunately, I'm not a good student and need a refresher. Now, I know it's easy to combine two cells into one if you know what they are, but what I have in mind is combining two cells on the fly, so to speak. A1 ---------- B1 _____________ Company --- Bud's I want to combine them so cell BI reads, `Bud's Company,' and cell A1 is empty. I want the user to be able to do this operation easily, maybe just pressing a `hot key' (CTRL-M, say) to accomplish it. I have tried to reconstruct the code that some from this newsgroup did for me, but I can't quite get it to work. Appreciate any help. Sam |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
= B1 & " " & A1
If you are entering it as formula try Range("C1").FormulaR1C1 = "=B1 & "" "" & A1" "Sam" wrote: Hi ... Some months ago I posted a question here, and someone was kind enough to show me how to write the code to do what I needed. Unfortunately, I'm not a good student and need a refresher. Now, I know it's easy to combine two cells into one if you know what they are, but what I have in mind is combining two cells on the fly, so to speak. A1 ---------- B1 _____________ Company --- Bud's I want to combine them so cell BI reads, `Bud's Company,' and cell A1 is empty. I want the user to be able to do this operation easily, maybe just pressing a `hot key' (CTRL-M, say) to accomplish it. I have tried to reconstruct the code that some from this newsgroup did for me, but I can't quite get it to work. Appreciate any help. Sam |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub CombineCells()
if activecell.column = 1 then exit sub activecell.value = activeCell.Text & " " & _ activecell.offset(0,-1).Text activecell.offset(0,-1).clearContents End Sub put it in a general module. Then go back to excel and do Tools=Macro=Macros select combinecells and click the options button. Assign a shortcut. -- Regards, Tom Ogilvy "Sam" wrote in message news:Blq5i.11464$xP.9277@trndny04... Hi ... Some months ago I posted a question here, and someone was kind enough to show me how to write the code to do what I needed. Unfortunately, I'm not a good student and need a refresher. Now, I know it's easy to combine two cells into one if you know what they are, but what I have in mind is combining two cells on the fly, so to speak. A1 ---------- B1 _____________ Company --- Bud's I want to combine them so cell BI reads, `Bud's Company,' and cell A1 is empty. I want the user to be able to do this operation easily, maybe just pressing a `hot key' (CTRL-M, say) to accomplish it. I have tried to reconstruct the code that some from this newsgroup did for me, but I can't quite get it to work. Appreciate any help. Sam |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Barb and Tom!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combining Cells | Excel Worksheet Functions | |||
Combining Cells | Excel Discussion (Misc queries) | |||
Combining cells | Excel Discussion (Misc queries) | |||
Combining Cells | Excel Programming | |||
combining two cells | Excel Programming |