The following bit of code loops through each sheet in an Excel workbook. When/if it finds a specific sheet it looks in a range to see if some text is there. If the text is not there it adds text,forumlas are inserted in certain ranges and other "stuff". What is happening it will do what I thought I asked it. But it also edits one other sheet. This other sheets name is not close to the one I want. I am using Access97 to control Excel2003. Does anyone have any ideas?
For i = 1 To EXFile.Application.Sheets.Count
strname = EXFile.Application.Sheets(i).Name
If ("IRP_Form" & VarNum) = EXFile.Application.Sheets(i).Name And IRPAudYr = Right(RST!IRPYrs, 2) And _
EXFile.Application.Sheets(i).Range("R14").Value <> "Page Description:" Then
EXFile.Application.Sheets(i).Activate
EXFile.Application.ActiveSheet.Range("S14:S16").Value = ""
EXFile.Application.ActiveSheet.Range("S19:S23").Value =
For i = 1 To EXFile.Application.Sheets.Count
strname = EXFile.Application.Sheets(i).Name
If ("IRP_Form" & VarNum) = EXFile.Application.Sheets(i).Name And IRPAudYr = Right(RST!IRPYrs, 2) And _
EXFile.Application.Sheets(i).Range("R14").Value <> "Page Description:" Then
EXFile.Application.Sheets(i).Activate
EXFile.Application.ActiveSheet.Range("S14:S16").Value = ""
EXFile.Application.ActiveSheet.Range("S19:S23").Value =