![]() |
Merge/Join 2 Excel tables
Hey, I found the code below somewhere (sorry, not sure where) a while back:
Sub MergeCols() Dim FBlank As Boolean Dim FRow As Integer FRow = 1 FBlank = IsEmpty(Cells(FRow, 1).Value) Do While FBlank = False Rows(FRow + 1 & ":" & FRow + 1).Insert Shift:=xlDown Cells(FRow, 2).Cut Destination:=Range("A" & FRow + 1) FRow = FRow + 2 FBlank = IsEmpty(Cells(FRow, 1).Value) Loop End Sub Hope it helps. -- RyGuy "ALV" wrote: Also, I'm doing this within an Excel 2007 Add-in, so I'm not importing an XLS file that is external to my app. "ALV" wrote: I'm looking for a fast way to programmatically merge 2 Excel tables into a third using common column[s] as join keys. One idea I had is to convert the tables to ADO.NET DataTables and run a SQL join command on them, then write out the result to Excel. Does that sound reasonable? If so, would someone have the syntax to convert Excel tables to ADO DataTables and back? Thanks. |
All times are GMT +1. The time now is 04:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com