close

I have this macro . This calculates the formuals and copis it to all
the 50 tabs in the workbook, but I want to stop it at the 50th tab
because the 51th tab is the master data that i dont want to touch. here
is the code. Please help me how to stop the macro from going ot the
last tab.

Sub 50sheets()
Dim ws As Worksheet
For Each ws In Worksheets
With Worksheets(ws.Name)
.Activate
.Range(quot;D8:O10quot;).Select
Selection.FillDown
.Range(quot;D8:O8quot;).Select

.Range(quot;D14:O18quot;).Select
Selection.FillDown

.Range(quot;D22:O25quot;).Select
Selection.FillDown

.Range(quot;D29:O33quot;).Select
Selection.FillDown

.Range(quot;D39:O41quot;).Select
Selection.FillDown

.Range(quot;D50:O63quot;).Select
Selection.FillDown

.Range(quot;D80:O80quot;).Select
Selection.FillDownEnd With
Next ws

Worksheets(quot;1quot;).Activate

End SubI think I'd just ignore that master worksheet--then I wouldn't care where it was
in the workbook.

Sub 50sheets()
Dim ws As Worksheet
For Each ws In Worksheets
with ws 'no need to get the name
if lcase(ws.name) = lcase(quot;masterquot;) then
'do nothing
else
'do the work
.Activate
.Range(quot;D8:O10quot;).Select
Selection.FillDown

quot; wrote:
gt;
gt; I have this macro . This calculates the formuals and copis it to all
gt; the 50 tabs in the workbook, but I want to stop it at the 50th tab
gt; because the 51th tab is the master data that i dont want to touch. here
gt; is the code. Please help me how to stop the macro from going ot the
gt; last tab.
gt;
gt; Sub 50sheets()
gt; Dim ws As Worksheet
gt; For Each ws In Worksheets
gt; With Worksheets(ws.Name)
gt; .Activate
gt; .Range(quot;D8:O10quot;).Select
gt; Selection.FillDown
gt; .Range(quot;D8:O8quot;).Select
gt;
gt; .Range(quot;D14:O18quot;).Select
gt; Selection.FillDown
gt;
gt; .Range(quot;D22:O25quot;).Select
gt; Selection.FillDown
gt;
gt; .Range(quot;D29:O33quot;).Select
gt; Selection.FillDown
gt;
gt; .Range(quot;D39:O41quot;).Select
gt; Selection.FillDown
gt;
gt; .Range(quot;D50:O63quot;).Select
gt; Selection.FillDown
gt;
gt; .Range(quot;D80:O80quot;).Select
gt; Selection.FillDown
gt;
gt; End With
gt; Next ws
gt;
gt; Worksheets(quot;1quot;).Activate
gt;
gt; End Sub

--

Dave Peterson

Hi Dave,
This doesnt work. Can you explpain this more . I tried to use it but it
crashed.

ThanksI think you'll have to post the code you used.

And did you change this line:

if lcase(ws.name) = lcase(quot;masterquot;) then

To use the real name of your quot;masterquot; worksheet--I guessed that its name was
quot;masterquot;.

quot; wrote:
gt;
gt; Hi Dave,
gt; This doesnt work. Can you explpain this more . I tried to use it but it
gt; crashed.
gt;
gt; Thanks

--

Dave Peterson

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()