setting range in another workbook in a two workbook routine

dinotom

Active Member
Joined
Aug 2, 2009
Messages
357
The code snippet below is giving me an error 438

I am simply trying to determine if the worksheet name from the source workbook is in the header row of the master workbooks data sheet.

The code barfs on the bolded line, where is my error? (FYI it also gives an error if I use Range("TraderHeaders") (error 1004)


Code:
 For Each ws In wbDataSource.Worksheets
                With wbMaster
                [B]Set rngToFind = .Range("TraderHeaders").Find(what:=ws.Name, MatchCase:= True)[/B]
                End With
Next ws
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If you don't define all arguements of the .Find statement, I believe they default to the find that was previously used.

See if this works:
Code:
    Set rngToFind = .Range("TraderHeaders").Find(what:=ws.Name, After:=.Range("TraderHeaders").Cells(1), _
        LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=True, SearchFormat:=False)
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,841
Members
452,948
Latest member
UsmanAli786

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