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

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Concatenate and Delete Macro

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Concatenate and Delete Macro

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
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
Macro - Import, Delete, Concatenate cranen Excel Programming 2 August 17th 09 10:01 PM
Concatenate and Delete Dee Sperling[_2_] Excel Programming 6 August 6th 09 08:15 PM
Delete then Concatenate Tempy Excel Programming 2 September 1st 05 02:37 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:54 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM


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