Excel macro between worksheets

5 pts.
Tags:
Excel 2003
Excel 2003 macros
Excel macros
Microsoft Excel
I have an Excel Workbook with a "Paid" sheet and an "Outstanding" sheet, both sheets have a File Number column. I would like to create a macro that looks through the "Outstanding" sheet and if the File Number from the "Outstanding" sheet is also in the "Paid" sheet can the entire row be deleted from the "Outstanding" sheet. Your help would be appreciated.
ASKED: October 27, 2008  4:59 AM
UPDATED: November 26, 2008  10:21 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Adavidson,
hope this macro code solves ur problem

‘*****************************************************************************************************
Sub test()
Dim l, m As Long
Dim i, j As Long

Sheets(“Outstanding”).Activate
Cells(1, 1).Activate

‘l used to find the last used cell in a column & the message box will display the No.of used cells in the File number column

l = Cells.Find(What:=”*”, After:=<a1], SearchOrder:=xlRows, SearchDirection:=xlPrevious).Row
MsgBox (“No.of rows in Outstanding sheet:” & l)
Sheets(“Paid”).Activate
Cells(1, 1).Activate
m = Cells.Find(What:=”*”, After:=<a1], SearchOrder:=xlRows, SearchDirection:=xlPrevious).Row
MsgBox (“No.of entries in Paid Sheet :” & m)
Sheets(“Outstanding”).Activate
Cells(1, 1).Activate

‘i—> Represents the column =File Number in Outstanding Sheet
‘j—> Represents the column =File Number in Paid Sheet
‘In this program i’ve fixed the “Filenumber” as the first column in both the sheets
‘in the place Cells(i, 1).Value & Cells(j, 1).Value change the values of second entry 1
‘ it won’t delete instead of that it will bold once u are ok then i ‘ll alter the code.

i = 1
j=1

For i = 1 To l
For j = 1 To m
If Sheets(“Outstanding”).Cells(i, 1).Value = Sheets(“Paid”).Cells(j, 1).Value Then
Sheets(“Paid”).Cells(j, 1).Font.Bold = True
End If
Next j
Sheets(“Outstanding”).Activate
ActiveCell.Offset(1, 0).Activate
Next i

Sheets(“Paid”).Activate

MsgBox (“Work Completed “)

End Sub

‘*****************************************************************************************************

Please send your queries reg this

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following