Worksheets

M

MB1

I'm new to VBA and programming, so be gentle!

I am trying to get a match for a string on one of my worksheets. With
the example below if the BTRT Winter 0809 sheet is manually
preselected then the statement works fine, however if another sheet
has been selected it doesn't work. Also if I use:
Workbooks("TaxCalculator").Worksheets(btrt).Activate prior to the
statement it also works.

Dim btrt As String
btrt = "BTRT Winter 0809"

logBookArray(3) =
Workbooks("TaxCalculator").Worksheets(btrt).Application.Match(logBookArray(1)
& logBookArray(2) & "346 ", Range("A1:A200"), 0) '.Offset(0, 1).Value

Any ideas?
 
D

Dave Peterson

I'd try qualifying the Range("A1:A200") to make sure it referred to the sheet
you want.

Should it be:
Workbooks("TaxCalculator").Worksheets(btrt).Range("A1:A200")
????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top