#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Simple (?) Macro

I have three columns of data similar to:
A B C
a 1a melon
b 2b lettuce

I want column c to read a1amelon
that much is easy but I want this to apply to every row to the end of the data
so that it reads like:

a 1a a1amelon
b 2b b2blettuce
etc.

Help is appreciated

--
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Simple (?) Macro

Try the following code:

Sub AAA()
Dim LastRow As Long
Dim FirstRow As Long
Dim RowNdx As Long
Dim WS As Worksheet
Dim S As String
Set WS = Worksheets("Sheet1") '<<< CHANGE AS REQUIRED
FirstRow = 1 '<<< CHANGE AS REQUIRED
On Error GoTo ErrH
Application.EnableEvents = False
With WS
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For RowNdx = FirstRow To LastRow
S = .Cells(RowNdx, "C")
S = Mid(.Cells(RowNdx, "B"), 2, 1) & _
Left(.Cells(RowNdx, "B"), 1) & S
.Cells(RowNdx, "C").Value = S
Next RowNdx
End With
ErrH:
Application.EnableEvents = True
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"NeedHelp" wrote in message
...
I have three columns of data similar to:
A B C
a 1a melon
b 2b lettuce

I want column c to read a1amelon
that much is easy but I want this to apply to every row to the end of the
data
so that it reads like:

a 1a a1amelon
b 2b b2blettuce
etc.

Help is appreciated

--
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Simple (?) Macro

Would this simple macro work to put all three in a NEW column to the right?

Sub combinecolumns()
lr = Cells(Rows.Count, "g").End(xlUp).Row
For Each c In Range("g2:g" & lr)
c.Offset(, 3) = c & c.Offset(, 1) & c.Offset(, 2)
Next
End Sub

OR as you requested to replace the third column
Sub combinecolumns1()
lr = Cells(Rows.Count, "g").End(xlUp).Row
For Each c In Range("g2:g" & lr)
c.Offset(, 2) = c & c.Offset(, 1) _
& c.Offset(, 2)
Next
End Sub

--
Don Guillett
SalesAid Software

"NeedHelp" wrote in message
...
I have three columns of data similar to:
A B C
a 1a melon
b 2b lettuce

I want column c to read a1amelon
that much is easy but I want this to apply to every row to the end of the
data
so that it reads like:

a 1a a1amelon
b 2b b2blettuce
etc.

Help is appreciated

--
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default Simple (?) Macro

Hi,

You can use a non-macro solution:

1. In column D enter the formula =A1&B1&C1
2. Copy this formula down as far a necessary
3. Select all the formulas and choose Copy.
4. Click on C1 and choose Edit, Paste Special, Values.
--
Cheers,
Shane Devenshire


"NeedHelp" wrote:

I have three columns of data similar to:
A B C
a 1a melon
b 2b lettuce

I want column c to read a1amelon
that much is easy but I want this to apply to every row to the end of the data
so that it reads like:

a 1a a1amelon
b 2b b2blettuce
etc.

Help is appreciated

--
Thanks

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
Simple Macro John Excel Worksheet Functions 1 November 17th 06 06:16 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 02:49 PM
Simple Macro MAStew New Users to Excel 3 July 27th 06 11:50 PM
How to stop Excel remembering/loading macro from previously opened Workbook Norman Yuan Excel Discussion (Misc queries) 4 June 17th 06 05:13 PM
Need Simple Macro jreinert New Users to Excel 2 June 15th 06 04:58 PM


All times are GMT +1. The time now is 06:58 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"