Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Combining cell entries to one cell with code

I have 8 cells in a range what I want to do is loop through these cells and
if they have a name in them put them in the same cell seperated with a comma
and a space, such as
if A1:A8 = my range then I want to see if any of these cells have a name in
them and if so I would get
A1 = John
A2 = Bob
A3 = Harry
B1 = John, Bob, Harry and so on
can this be done?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Combining cell entries to one cell with code

Sub names()

Dim i As Integer
Dim s As String

With Range("a1")
Do Until IsEmpty(.Offset(i, 0))
s = s & .Offset(i, 0).Value & ","
i = i + 1
Loop

End With
s = Left(s, Len(s) - 1)

Range("b1").Value = s

End Sub

"jnf40" wrote:

I have 8 cells in a range what I want to do is loop through these cells and
if they have a name in them put them in the same cell seperated with a comma
and a space, such as
if A1:A8 = my range then I want to see if any of these cells have a name in
them and if so I would get
A1 = John
A2 = Bob
A3 = Harry
B1 = John, Bob, Harry and so on
can this be done?

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
How can cell entries be based on word entries in another cell ? lifewings Excel Worksheet Functions 1 June 24th 08 05:45 PM
How to line break in one cell via a formula to stack cell entries Barb @ Work Excel Worksheet Functions 7 April 15th 08 09:01 PM
Combining cell entries to one cell jnf40 Excel Programming 0 October 4th 07 05:00 PM
Combining multiple cell information into one cell Pete Elbert Excel Discussion (Misc queries) 0 December 13th 06 11:36 AM
Way to have VB code to filter on entries that have cell with today's date? StargateFan[_3_] Excel Programming 7 May 17th 05 01:44 PM


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

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

About Us

"It's about Microsoft Excel"