Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Combine Two Worksheets

Thanks for your help with this, worked like a charm.


Per Jessen wrote:
Hi

Insert the code in "File2", and change file / sheet names as required.

Sub Combine()
Dim wbA As Workbook
Dim wbB As Workbook
Dim shA As Worksheet
Dim shB As Worksheet

Set wbA = ThisWorkbook
Set wbB = Workbooks("File1.xls") 'Change name to suit
Set shA = wbA.Worksheets("Sheet1")
Set shB = wbB.Worksheets("Sheet1")

LastRow = shA.Range("A1").End(xlDown).Row

For r = 2 To LastRow ' Headings in row 1
EndUser = Cells(r, 1).Value
Set f = shB.Columns("A").Find(what:=EndUser, LookAt:=xlWhole)
If Not f Is Nothing Then
shA.Cells(r, 4) = shB.Cells(f.Row, 5).Value
Set f = Nothing
End If
Next
End Sub

Regards,
Per

On 8 Maj, 15:11, "Evan_Robitaille via OfficeKB.com" <u28944@uwe
wrote:
I have two files with the following columns:

[quoted text clipped - 19 lines]
--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200905/1


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200905/1

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
Combine 3 of 6 worksheets Tasha Excel Discussion (Misc queries) 1 August 24th 09 08:44 PM
How do I combine worksheets w/o enough rows to combine? Amanda W. Excel Worksheet Functions 3 June 9th 09 07:26 AM
Combine Worksheets William@Target Excel Worksheet Functions 2 March 8th 07 09:19 PM
How to combine several worksheets Mark D. Brown, MSW Setting up and Configuration of Excel 1 January 4th 06 05:05 PM
Combine All Worksheets into one Yogi_Bear_79 Excel Programming 1 January 29th 04 05:39 PM


All times are GMT +1. The time now is 07:55 AM.

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"