PC Review


Reply
Thread Tools Rate Thread

Combining cell entries to one cell with code

 
 
=?Utf-8?B?am5mNDA=?=
Guest
Posts: n/a
 
      4th Oct 2007
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 With Quote
 
 
 
 
=?Utf-8?B?U2FtIFdpbHNvbg==?=
Guest
Posts: n/a
 
      4th Oct 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Microsoft Excel Misc 0 29th Jun 2009 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Microsoft Excel Misc 0 26th Jun 2009 06:01 PM
How can cell entries be based on word entries in another cell ? lifewings Microsoft Excel Worksheet Functions 1 24th Jun 2008 05:45 PM
Way to have VB code to filter on entries that have cell with today's date? StargateFan Microsoft Excel Programming 7 17th May 2005 01:44 PM
combining cell entries rjz@haaghuishof.nl Microsoft Excel Discussion 1 4th Jul 2003 03:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:33 PM.