Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Concatenating two spreadsheets by a column

On Oct 14, 3:06*pm, joel wrote:
Create a new sheet called Summary and run this code. *I'm using columns
E and R from the two source sheets.

Private Sub cmdUpdate_Click()

Dim c1 As Range
Dim RowCount As Long
Dim NewRow As Long
Dim LastCol As Long
Dim NewCol As Long

Set Sumsht = Sheets("Summary")
NewRow = 2
For Each sht In Sheets
If sht.Name < Sumsht.Name Then
With sht
RowCount = 2
Do While .Range("E" & RowCount) < ""
Index = .Range("E" & RowCount)
Data = .Range("R" & RowCount)

With Sumsht
'search if Index already exists
Set c = .Columns("A").Find(what:=Index, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
'add data to column B
.Range("A" & NewRow) = Index
.Range("B" & NewRow) = Data
NewRow = NewRow + 1
Else
'find last column used
LastCol = .Cells(c.Row,
Columns.Count).End(xlToLeft).Column
NewCol = LastCol + 1
.Cells(c.Row, LastCol) = Data
End If
RowCount = RowCount + 1
End With
Loop
End With
End If

Next sht
End Sub

--
joel
------------------------------------------------------------------------
joel's Profile:http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=144045


Hi joel ! Thanks for your input.

Unfortunately when I try to run this code I get a message :

Compile error
Can't assign to read only property
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
Concatinating two spreadsheets by a column Georgi Excel Programming 3 October 13th 09 09:08 PM
Concatenating all records in column b where column a=x steve-o Excel Discussion (Misc queries) 2 November 19th 08 05:42 PM
comparing a column in two separate spreadsheets childofthe1980s Excel Programming 2 October 18th 08 06:47 PM
Date column changed to number format while concatenating Biju Jacob Excel Discussion (Misc queries) 1 June 12th 06 07:07 PM
Combine two spreadsheets with Different column headings Angela Excel Discussion (Misc queries) 5 December 8th 05 10:25 PM


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