Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to combine cells


Hi Guys great forum

im trying to create a macro that combines data from cells at any point
in my spreadsheet.

for instance I want to combine 3 cells that have a name in i.e

A= MR
B= JOHN
C= SMITH

however i also to combine there addresses e.g x = 74 y = the z= green.

is there any type of vba that could perform this for me.

any help will be greatly appreciated.


--
c mcg
------------------------------------------------------------------------
c mcg's Profile: http://www.excelforum.com/member.php...o&userid=33560
View this thread: http://www.excelforum.com/showthread...hreadid=533465

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Macro to combine cells

I'm not entirely clear what you want, but the & operator combines
text strings. E.g.,

Dim Res As String
Res = Range("A1").Value & " " & Range("B1").Value & " " &
Range("C1").Value
MsgBox Res

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"c mcg"
wrote in message
...

Hi Guys great forum

im trying to create a macro that combines data from cells at
any point
in my spreadsheet.

for instance I want to combine 3 cells that have a name in i.e

A= MR
B= JOHN
C= SMITH

however i also to combine there addresses e.g x = 74 y = the z=
green.

is there any type of vba that could perform this for me.

any help will be greatly appreciated.


--
c mcg
------------------------------------------------------------------------
c mcg's Profile:
http://www.excelforum.com/member.php...o&userid=33560
View this thread:
http://www.excelforum.com/showthread...hreadid=533465



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to combine cells


Basicly I have a spreadsheet that has information on people in it.
columns A to C have a name broken down into 3 sections consisting of a
title, first name and surname. I then have in columns G, H, and I which
is an address that is broken into 3 sections consisting of door number,
street name and town.

I have to combine the data in these cells so that all information goes
into one cell. The thing is I have a spreadsheet of around 200 rows and
i need to run this on each row.

I previously had a macro to do this for me that a friend of mine who i
can no longer contact created for me but when i upgraded my computer i
lost it. as far as i know the macro moved any highlighted cells data to
the first highlighted column.

Sorry to be a bit vague and thanks for your help.


--
c mcg
------------------------------------------------------------------------
c mcg's Profile: http://www.excelforum.com/member.php...o&userid=33560
View this thread: http://www.excelforum.com/showthread...hreadid=533465

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to combine cells

It's hard to tell what you want.

Do you want to set D1 to the following:
= A1 & " " & B1 & " " & C1

and then drag D1 down ~200 rows, so that Dn ends up being set to the
following for all n?
= An & " " & Bn & " " & Cn

And similarly for J, based on G, H, and I?

Or should all 6 fields be combined into a single cell? Or is it more
complicated? Are you looking to write code, so you can avoid the copying?

Naomi


"c mcg" wrote in
message ...

Basicly I have a spreadsheet that has information on people in it.
columns A to C have a name broken down into 3 sections consisting of a
title, first name and surname. I then have in columns G, H, and I which
is an address that is broken into 3 sections consisting of door number,
street name and town.

I have to combine the data in these cells so that all information goes
into one cell. The thing is I have a spreadsheet of around 200 rows and
i need to run this on each row.

I previously had a macro to do this for me that a friend of mine who i
can no longer contact created for me but when i upgraded my computer i
lost it. as far as i know the macro moved any highlighted cells data to
the first highlighted column.

Sorry to be a bit vague and thanks for your help.


--
c mcg
------------------------------------------------------------------------
c mcg's Profile:

http://www.excelforum.com/member.php...o&userid=33560
View this thread: http://www.excelforum.com/showthread...hreadid=533465



Reply
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
Combine cells with the same reference and combine quantities brandon Excel Discussion (Misc queries) 2 September 17th 08 05:44 PM
Combine Cells candy_k99 Excel Discussion (Misc queries) 4 October 17th 06 03:49 PM
combine cells Mindy Excel Discussion (Misc queries) 4 December 1st 05 09:41 PM
Combine 2 macro bioyyy Excel Discussion (Misc queries) 3 October 17th 05 07:58 PM
Macro to combine cells Bob Excel Programming 7 December 10th 04 09:11 PM


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

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

About Us

"It's about Microsoft Excel"