Recall rows of data from an excel table - error

Dancey_

New Member
Joined
Aug 18, 2010
Messages
41
Hey guys,

Can someone please help me, I have the below code:

Code:
Sub RecallSales()

On Error GoTo ErrHandler

Application.ScreenUpdating = False

Dim MyCheck As Range

Workbooks.Open "\\GD-NAS02\Helpdesk\Renewal Retention Team\eConversion Sales Reporting\Sales\Database\Sales Database.xlsm"

For Each MyCheck In Workbooks("Sales Database.xlsm").Sheets("Sales").Range("C1:C1000")

If MyCheck.Value = ThisWorkbook.Sheets("Agent Daily Report").Range("B1").Value Then

Range(ActiveCell.Offset(-2, 0), ActiveCell.Offset(9, 0)).Select

Range(ActiveCell.Offset(-2, 0), ActiveCell.Offset(9, 0)).Copy

Workbooks("Sales Database.xlsm").Sheets("Sales").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues

Else: MsgBox "No sales recorded today"

Workbooks("Sales Database.xlsm").Close

Exit Sub

End If

Next MyCheck

Workbooks("Sales Database.xlsm").Close

ErrHandler:
    MsgBox "The message text of the error is: " & Error(Err)

End Sub

I have a excel table that is updated by a different sub and is a table of sales input by sales agents.

The idea of this sub is to allow the agent to select their name from a drop down in B1 and then it will pull all sales made by them and put them into a table on the same sheet.

My sub is jumping straight to the "no sales recorded" MsgBox. For some reason it isnt picking up that MyCheck.Value does indeed equal B1.Value. I have manually input an agents name instead of Range("B1").Value but it still doesn't work.

Please help!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,224,520
Messages
6,179,270
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top