Error 438 on With statement

T

tmwilkin

I am getting the run-time 438 error on the below code:

Sub loan_cap()

' REFRESHES LOAN CAPS

Application.ScreenUpdating = False

Dim Here As Workbook, Caps1 As Workbook, Caps2 As Workbook, Caps3 As Workbook
Set Here = ThisWorkbook

Workbooks.Open "xxx.xls"
Workbooks.Open "xxx.xls"
Workbooks.Open "xxx.xls"

Set Caps1 = Workbooks("$75K-$100K+ Deals by member.xls")
Set Caps2 = Workbooks("$75K-$100K+ Deals by transaction.xls")
Set Caps3 = Workbooks("$75K-$100K+ Deals by transaction2.xls")

Dim LC As Worksheet, There As Worksheet
Set LC = Here.Sheets("LoanCaps")
Dim rng As Range

With Here.LC
.Range("LOANCAP1").ClearContents
.Range("LOANCAP2").ClearContents
.Range("LOANCAP3").ClearContents
.Range("LOANCAP4").ClearContents
.Range("LOANCAP5").ClearContents
.Range("LOANCAP6").ClearContents
.Range("LOANCAP7").ClearContents
End With

I keep getting the error at the beginning of the With statement. I'm
wondering if, since I opened three other workbooks, is there a conflict the
what Excel thinks "Here" is?

Thanks in advance!
 
J

Jim Cone

Change...

With Here.LC
- to -
With LC
--
Jim Cone
Portland, Oregon USA



"tmwilkin"
<[email protected]>
wrote in message
I am getting the run-time 438 error on the below code:

Sub loan_cap()
' REFRESHES LOAN CAPS
Application.ScreenUpdating = False
Dim Here As Workbook, Caps1 As Workbook, Caps2 As Workbook, Caps3 As Workbook
Set Here = ThisWorkbook
Workbooks.Open "xxx.xls"
Workbooks.Open "xxx.xls"
Workbooks.Open "xxx.xls"
Set Caps1 = Workbooks("$75K-$100K+ Deals by member.xls")
Set Caps2 = Workbooks("$75K-$100K+ Deals by transaction.xls")
Set Caps3 = Workbooks("$75K-$100K+ Deals by transaction2.xls")
Dim LC As Worksheet, There As Worksheet
Set LC = Here.Sheets("LoanCaps")
Dim rng As Range

With Here.LC
.Range("LOANCAP1").ClearContents
.Range("LOANCAP2").ClearContents
.Range("LOANCAP3").ClearContents
.Range("LOANCAP4").ClearContents
.Range("LOANCAP5").ClearContents
.Range("LOANCAP6").ClearContents
.Range("LOANCAP7").ClearContents
End With

I keep getting the error at the beginning of the With statement. I'm
wondering if, since I opened three other workbooks, is there a conflict the
what Excel thinks "Here" is?
Thanks in advance!
 

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