Hi,

Not a VBA developer but I am writing private sub within a module that uses two workbook variables which are declared globally. The two variables are MyWbk and TempWbk - both are set in other subs...

Private Sub Copy_Data()

Dim Frsthdrtxt As String
Dim Frstcol as Integer

' set focus on the temp wbk
Tempwbk.Activate

'find the first header's value in TempWbk and find it in MyWbk

Frsthdrtxt = Tempwbk.Sheets(1).Range("A1").Text

Mywbk.Activate

Frstcol = Mywbk.Sheets("Contracts").Cells.Find(Frsthdrtxt, SearchOrder:=xlByColumns, SearchDirection:=xlNext).Column
It is this final line that brings up the 91 "Object Variable not set" error - but the object is Set in an earlier sub...

if i change the Frsthdrtxt in the Find statement to "*" - the statement executes....if i change it to a hard coded text string such as "MYTEXT" - i get the 91 error again....

The purpose of the above statement is to grab the header from A1 in the Temp workbook, assign it to the variable Frsthdrtxt and find that in My Workbook, i thought it would be simple, but i'm getting stuck...

I've tried setting MyWbk and TempWbk to Nothing in the Sub and then putting in the Set statements within the Private Sub in which this line is executing, but that hasn't worked....any help is greatly appreciated!