skull_eagle
Board Regular
- Joined
- Mar 25, 2011
- Messages
- 89
Hi,
I keep getting an End With without With Error.
I'm not sure why as I clearly have a With statement.
Any help would be much appreciated.
Thank you
I keep getting an End With without With Error.
I'm not sure why as I clearly have a With statement.
Any help would be much appreciated.
Thank you
VBA Code:
Dim State As String
Dim Site As String
Dim wsST As Worksheet
Dim wsRst
State = FindForm.Controls("CM_State").Value
Site = FindForm.Controls("CM_Site").Value
wsRst = Worksheets("Results")
wsST = Worksheets(State)
wsST.Activate
Firstrow = Rows(6)
Lastrow = wsST.Range("B500000").End(xlUp).Row
For Lrow = Lastrow To Firstrow Step -1
With wsST.Cells(Lrow, 2)
If Not IsError(.Value) Then
If .Value = Site Then
wsST.Range(Cells(Lrow, 2), Cells(Lrow + 7, 10)).Copy
Rows(Lrow & ":" & Lrow + 7).Copy wsRst.Range("3:10")
End If
End With
Next Lrow