Why Doesn't This Nested "with" work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Why do I get an "End with without With" error on this? Assume that all the
other work is correct in this snippet, but I get the error on the final end
with. This is in a UserForm procedure when the user clicks an OK button, if
that matters. According to the Help, you can nest with commands.....


With rngCoOwners
.Sort Key1:="Last Name", Order1:=xlAscending, Key2:="First
Name",_ Order2:=xlAscending, Header:=xlYes
For intCounter = 1 To .Rows.Count
If .Cells(intCounter, 12) = "Yes" Then
Set wkshtCoOwnerStatement =
ActiveWorkbook.Worksheets(.Cells_(intCounter, 2) & ", " &
Left(.Cells(intCounter, 3), 1))
Set rngStatementHeader =
wkshtCoOwnerStatement.Range_("tblStatementHeader")
With rngStatementHeader
.Cells(rngStatementHeader.Rows.Count, 1).Value =
"Send Check_ Payable to: Happy Hollow RV Resort, " & Me.txtboxReturnAddress
End With
End If 'check to see if they are current
End With
 
Ignore the _ characters in there, I put them in based on the wordwrap of the
message positing page, then it formatted them differently when it posted to
the site.....
 
Necer mind, I figured it out. I forgot the next to go with the counter loop.
 
I'm glad to see that I am not the only one that posts a question then shortly
after that, not being able to give it a rest, figure out the answer :)
 

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

Similar Threads


Back
Top