macro was working, now it's not working

R

RichardO

Hello all:

I have the following macro which on clicking YES, would run th
formatsummary which does some things to the "Summary" worksheet. The
it adds 1 workday to cell B4 of the "Summary" worksheet.

When I run the macro, I am getting a compiler error with (.Rang
highlighted in yellow.

Before I added the:

If MsgBox("Click Yes to refresh workbook", vbYesNo) = vbYess Then
...
End If

The macro worked okay, now it's not working fine.

Thanks for helping.



Private Sub Workbook_Open()
If MsgBox("Click Yes to refresh workbook", vbYesNo) = vbYess Then
formatsummary
With Worksheets("Summary").[b4] = workday(.Range("B4"), 1)
End With
End If
End Su
 
W

William

Hi Richard

Should "vbYess" be "vbYes"?
--
XL2002
Regards

William

[email protected]

| Hello all:
|
| I have the following macro which on clicking YES, would run the
| formatsummary which does some things to the "Summary" worksheet. Then
| it adds 1 workday to cell B4 of the "Summary" worksheet.
|
| When I run the macro, I am getting a compiler error with (.Range
| highlighted in yellow.
|
| Before I added the:
|
| If MsgBox("Click Yes to refresh workbook", vbYesNo) = vbYess Then
| ..
| End If
|
| The macro worked okay, now it's not working fine.
|
| Thanks for helping.
|
|
|
| Private Sub Workbook_Open()
| If MsgBox("Click Yes to refresh workbook", vbYesNo) = vbYess Then
| formatsummary
| With Worksheets("Summary").[b4] = workday(.Range("B4"), 1)
| End With
| End If
| End Sub
|
|
| ---
|
|
 
R

RichardO

You're right, I changed the Yess to Yes,

The formatsummary macro is running okay, but then I got a debug erro
when the code got to:


With Worksheets("Summary")
.[b4] = workday(.Range("B4"), 1)
End With

the .Range is highlighted in blue, while the name of the function:

Private Sub Workbook_Open() is highlighted in yellow.

Can you tell what's happening. Again, when I didn't have the If
statement below the code ran okay:

MsgBox("Click Yes to refresh workbook", vbYesNo) = vbYes Then
. ..
End If


Thanks agai
 
Top