PC Review


Reply
Thread Tools Rate Thread

Concatenate and Delete Macro

 
 
cranen
Guest
Posts: n/a
 
      21st Aug 2009
I am looking for some code to cocatenate and delete. Below is an example.

Raw Data:

A B C
1 243A030 SQYD Geosynthetic Reinforcement
2 Type 1
3 243B001 SQYD Expanded Mesh

Formatted Data:

A B C
1 243A030 SQYD Geosynthetic Reinforcement Type 1
2 243B001 SQYD Expanded Mesh

I was using a function to Concatenate, but I want to combine it in a macro
to delete the row afterwards (See Row 2 in Raw Data). The "if" statement I
was using -

=if(A2="",CONCATENATE(C1," ",C2),C1)

If it Concatenates, I want it to delete. I am working with about 9600 rows
of data. Any help would be greatly appreciated. Thanks so much.
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      21st Aug 2009
Try the below macro which works on the activesheet. Col A,B,C

Sub Macro()
Dim lngRow As Long, strData As String
For lngRow = Cells(Rows.Count, "c").End(xlUp).Row To 1 Step -1
If Trim(Range("A" & lngRow)) = "" Then
strData = Trim(Range("c" & lngRow))
Rows(lngRow).Delete
lngRow = lngRow - 1
Range("C" & lngRow) = Trim(Range("C" & lngRow) & " " & strData)
strData = ""
End If
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"cranen" wrote:

> I am looking for some code to cocatenate and delete. Below is an example.
>
> Raw Data:
>
> A B C
> 1 243A030 SQYD Geosynthetic Reinforcement
> 2 Type 1
> 3 243B001 SQYD Expanded Mesh
>
> Formatted Data:
>
> A B C
> 1 243A030 SQYD Geosynthetic Reinforcement Type 1
> 2 243B001 SQYD Expanded Mesh
>
> I was using a function to Concatenate, but I want to combine it in a macro
> to delete the row afterwards (See Row 2 in Raw Data). The "if" statement I
> was using -
>
> =if(A2="",CONCATENATE(C1," ",C2),C1)
>
> If it Concatenates, I want it to delete. I am working with about 9600 rows
> of data. Any help would be greatly appreciated. Thanks so much.

 
Reply With Quote
 
cranen
Guest
Posts: n/a
 
      21st Aug 2009
Awesome. I really, really appreciate your help.

"Jacob Skaria" wrote:

> Try the below macro which works on the activesheet. Col A,B,C
>
> Sub Macro()
> Dim lngRow As Long, strData As String
> For lngRow = Cells(Rows.Count, "c").End(xlUp).Row To 1 Step -1
> If Trim(Range("A" & lngRow)) = "" Then
> strData = Trim(Range("c" & lngRow))
> Rows(lngRow).Delete
> lngRow = lngRow - 1
> Range("C" & lngRow) = Trim(Range("C" & lngRow) & " " & strData)
> strData = ""
> End If
> Next
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "cranen" wrote:
>
> > I am looking for some code to cocatenate and delete. Below is an example.
> >
> > Raw Data:
> >
> > A B C
> > 1 243A030 SQYD Geosynthetic Reinforcement
> > 2 Type 1
> > 3 243B001 SQYD Expanded Mesh
> >
> > Formatted Data:
> >
> > A B C
> > 1 243A030 SQYD Geosynthetic Reinforcement Type 1
> > 2 243B001 SQYD Expanded Mesh
> >
> > I was using a function to Concatenate, but I want to combine it in a macro
> > to delete the row afterwards (See Row 2 in Raw Data). The "if" statement I
> > was using -
> >
> > =if(A2="",CONCATENATE(C1," ",C2),C1)
> >
> > If it Concatenates, I want it to delete. I am working with about 9600 rows
> > of data. Any help would be greatly appreciated. Thanks so much.

 
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
Macro - Import, Delete, Concatenate cranen Microsoft Excel Programming 2 17th Aug 2009 10:01 PM
Concatenate and Delete Dee Sperling Microsoft Excel Programming 6 6th Aug 2009 08:15 PM
Concatenate Macro Dan R. Microsoft Excel Programming 1 4th Jan 2007 09:49 PM
Concatenate Macro =?Utf-8?B?b3Nha2E3OA==?= Microsoft Excel Misc 6 9th Apr 2006 01:34 PM
Delete then Concatenate Tempy Microsoft Excel Programming 1 1st Sep 2005 12:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:22 AM.