Simon Lloyd;436383 Wrote:
Are you opening the workbook called LCLI? or has the workbook you are
working with got a sheet called LCLI?, because thats your problem, your
code (albeit a bit lengthy) works fine, you just are pointing it to work
on a workbook that isn't active or if it is it does not contain the
worksheet LCLI.
Can you clarify?As a test you can add this to the very top of your code after Sub
LCLI_NEW
Code:
--------------------
Dim ShFound As String, MySht As Long
For Each Sheet In ActiveWorkbook.Sheets
If Sheet.Name = "LCLI" Then
MySht = 1
End If
ShFound = ShFound & vbLf & Sheet.Name
Next Sheet
MsgBox "Sheets present in workbook" & vbLf & ShFound, vbOKOnly, "Sheets Available"
If MySht < 1 Then Exit Sub
--------------------
this code will show you the names of all the sheets available in the
active workbook and will exit your code if the sheet you want to work
with is not present!
--
Simon Lloyd
Regards,
Simon Lloyd
'Microsoft Office Help' (
http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:
http://www.thecodecage.com/forumz/member.php?userid=1
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=120622