Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Concetating Two Columns in Excel VBA

I'm not sure if Concetating is the exact way to go about this but what
I'm trying to do is take:

Drawing Amount | Drawing Number
--------------------------------------------------
4 506888
6 506889
2 506888
3 506889


And make it look like:


Drawing Amount | Drawing Number
--------------------------------------------------
6 506888
9 506889


Through a button-push on VBA.
Anyone have any ideas on how to accomplish this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Concetating Two Columns in Excel VBA

The following assumes your data is in cells A1:B5 of Sheet1.

Sub Macro1()
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
ws.Range("B1:B5").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=ws.Range("E1"), Unique:=True
ws.Range("D2").FormulaR1C1 =
"=SUMIF(RC[-2]:R[3]C[-2],RC[1],RC[-3]:R[3]C[-3])"
ws.Range("D2").Copy ws.Range("D3")
ws.Range("D2:E3").Copy
ws.Range("D2").PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ws.Range("A2:B5").Clear
ws.Range("D2:E3").Copy ws.Range("A2")
ws.Range("D1:E3").Clear
End Sub

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Concetating Two Columns in Excel VBA

You could create a pivot table which would give you that output in another
location.

Data=Pivot Table Report and Chart

--
Regards,
Tom Ogilvy


"AyeJay" wrote:

I'm not sure if Concetating is the exact way to go about this but what
I'm trying to do is take:

Drawing Amount | Drawing Number
--------------------------------------------------
4 506888
6 506889
2 506888
3 506889


And make it look like:


Drawing Amount | Drawing Number
--------------------------------------------------
6 506888
9 506889


Through a button-push on VBA.
Anyone have any ideas on how to accomplish this?


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
putting 2 long columns into multiple columns in excel page and sor bob_mhc Excel Discussion (Misc queries) 1 April 25th 08 07:51 AM
Excel 2003 - change columns to rows and rows to columns JLatham Excel Discussion (Misc queries) 0 August 17th 07 02:05 AM
Excel 2007 extra columns - but transposing columns still not working! [email protected] Excel Programming 0 July 26th 06 02:58 PM
How to merge columns from excel and how to set customize each columns lancelot Excel Programming 0 March 25th 06 03:44 AM
Excel button :: Filter columns by value - possible? Additionally, hide certain columns No Name Excel Programming 4 December 28th 04 07:44 PM


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