VBA ScrollArea = "Range"

Re: VBA scroll area for odd sheets

You are welcome. :)
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Re: VBA scroll area for odd sheets

Hi Peter,

I'm having a little difficulty in applying this code that you last posted.

WRT, the actual tab/sheet that I want to omit from the code lock is actually Sheet(4), where its physical location in workbook lies in the 2ND tab being part of the EVEN
Code:
ScrollArea
when applied across the workbook.

I know this because when I run the code, it provides a scroll lock on Sheet(4)
of which I've named "TOTALS"
Code:
Sheet4(TOTALS)
for the ODD lock of the
Code:
ScrollArea = "A1:L80"
code, where I'd originally thought it was being applied over the EVEN tabs of
Code:
ScrollArea = "A1:BK80"
.



When I do run your code, I've noticed that it doesn't seem to omit any sheets from the
Code:
ScrollArea
as far as I can tell. Where, I did check all of the sheets/tabs that I do have on the workbook.(?)



I'd thought that if I changed what you provided that I'd get it to work; for example:


Code:
For i = 2 To Sheets.Count Step 2
    If i <> 2 Then Sheets(i).ScrollArea = "A1:L80"
Next i



But it is not working and I need your help.

Any suggestions??

Thank you!

Pinaceous


PS. Just out of curiosity, why doesn't this part of the code require an
Code:
End IF
statement?
 
Upvote 0
Re: VBA scroll area for odd sheets

I didn't understand everything that you wrote, but the following code will bypass Sheets(2), not Sheets(4). You would need to change the red 2 in the code to 4 if you want to bypass the 4th sheet from the left hand side.
I'd thought that if I changed what you provided that I'd get it to work; for example:


Code:
For i = 2 To Sheets.Count Step 2
    If i <> [COLOR="#FF0000"][B]2[/B][/COLOR] Then Sheets(i).ScrollArea = "A1:L80"
Next i


PS. Just out of curiosity, why doesn't this part of the code require an End IF statement?
Because there is only a single statement following the If ... Then and that statement is written on the same line, not a new one.
 
Upvote 0
Re: VBA scroll area for odd sheets

Hi Peter!

Yes, that helps quite a bit!

Respectively,
Pinaceous
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top