Networkdays code error

  • Thread starter Thread starter dgd1212
  • Start date Start date
D

dgd1212

Code to perform networkdays function:

Set rng = Sheets("Job Details").[C3]
Set hols = Range(Sheets("Hide").[E2], Sheets("Hide").[E11])
Set myrange = Union(rng, hols)

If Not Intersect(myrange, target) Is Nothing Then
Range("Hide!D2").GoalSeek Goal:=6, ChangingCell:=Range("Hide!C2")
End If

MsgBox "The date 6 working days from " & Sheets("Job Details").[A1]
& " will be: " & WorksheetFunction.Text(Sheets("Hide").[C2], "mm/dd/yyyy")

This line errors out:
Set hols = Range(Sheets("Hide").[E2], Sheets("Hide").[E11])
Looks like it should work. What am I missing?
Thanks
 
This line errors out:
Set hols = Range(Sheets("Hide").[E2], Sheets("Hide").[E11])
Looks like it should work. What am I missing?
Thanks

Works OK here:

==================
Sub foo()
Dim hols As Range
Set hols = Range(Sheets("Hide").[E2], Sheets("Hide").[E11])
Debug.Print hols.Address
End Sub
=====================
-->$E$2:$E$11
=====================

What is the error message?
--ron
 

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

Back
Top