Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Another Join/Merge Question

I have several worksheets that have purchase order data on them:

PO Num Order Date Vendor Status

I have one worksheet called "Paid Invoices".

Status is changed from "Open" to "Paid" based on a PO match. What I would
like to do is to create an Accrual worksheet that searches through the PO
Data worksheets for anything that's still "Open" and returns that row's
information to the Accrual worksheet.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 364
Default Another Join/Merge Question

Try this
'Read through the comments marked with '
Sub CopyOpenPO()
'Workbook must contain a Summary sheet named Accrual

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim ws As Worksheet
Dim LastRow As Integer

'j contains the index of the column which contains Open status
'j=1 implies column A
j = 4 'Assuming status is in Col D

'Assuming first row on Accrual sheet has header information
k = 2

'Loop through all sheets
For Each ws In Worksheets
i = 1
ws.Activate
'Process if worksheet name is not in (Accrual,Paid Invoices)
If WorksheetFunction.And(ws.Name < "Accrual", ws.Name < "Paid Invoices")
Then
LastRow = Range("A65536").End(xlUp).Row
For i = 1 To LastRow
ws.Activate
If Cells(i, j) = "Open" Then
Cells(i, 1).EntireRow.Copy
Sheets("Accrual").Activate
Cells(k, 1).Select
ActiveSheet.Paste
k = k + 1
End If
Next i
End If
Next ws
MsgBox "Process Complete"
End Sub

"Dave" wrote:

I have several worksheets that have purchase order data on them:

PO Num Order Date Vendor Status

I have one worksheet called "Paid Invoices".

Status is changed from "Open" to "Paid" based on a PO match. What I would
like to do is to create an Accrual worksheet that searches through the PO
Data worksheets for anything that's still "Open" and returns that row's
information to the Accrual worksheet.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Another Join/Merge Question

This is working PERFECTLY!!!!

Thank you SO MUCH!!!

"Sheeloo" wrote:

Try this
'Read through the comments marked with '
Sub CopyOpenPO()
'Workbook must contain a Summary sheet named Accrual

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim ws As Worksheet
Dim LastRow As Integer

'j contains the index of the column which contains Open status
'j=1 implies column A
j = 4 'Assuming status is in Col D

'Assuming first row on Accrual sheet has header information
k = 2

'Loop through all sheets
For Each ws In Worksheets
i = 1
ws.Activate
'Process if worksheet name is not in (Accrual,Paid Invoices)
If WorksheetFunction.And(ws.Name < "Accrual", ws.Name < "Paid Invoices")
Then
LastRow = Range("A65536").End(xlUp).Row
For i = 1 To LastRow
ws.Activate
If Cells(i, j) = "Open" Then
Cells(i, 1).EntireRow.Copy
Sheets("Accrual").Activate
Cells(k, 1).Select
ActiveSheet.Paste
k = k + 1
End If
Next i
End If
Next ws
MsgBox "Process Complete"
End Sub

"Dave" wrote:

I have several worksheets that have purchase order data on them:

PO Num Order Date Vendor Status

I have one worksheet called "Paid Invoices".

Status is changed from "Open" to "Paid" based on a PO match. What I would
like to do is to create an Accrual worksheet that searches through the PO
Data worksheets for anything that's still "Open" and returns that row's
information to the Accrual worksheet.

Thanks!

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
Join tables like inner join in Access ryanp Excel Discussion (Misc queries) 2 July 18th 08 03:35 PM
Merge or Join Worksheets Kevin Excel Discussion (Misc queries) 0 October 4th 07 09:42 PM
How do I join or merge worksheets in Excel PurpleMel Excel Discussion (Misc queries) 3 June 11th 07 10:58 PM
Merge /Join data Kevin R Excel Discussion (Misc queries) 2 March 22nd 07 11:32 PM
Merge question JoAnn Paules - MVP Publisher New Users to Excel 2 July 5th 05 09:25 AM


All times are GMT +1. The time now is 04:26 AM.

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"