Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 115
Default HOW TO TURN ON 'AUTOSUM' ON ON A PROTECTED SHEET THRO VB

D/EARL
Thank you Earl and I got one more thread closed. Your adivce worked
and i am happy for the progress this site is providing.


On Jan 31, 1:21 am, "Earl Kiosterud" wrote:
Capt,

As an alternative, you might want to consider this. Put your totals at the
top of the sheet, e.g.: =SUM(A2:A65536). Now rows can be added and they're
included. If you freeze the row(s) containing the totals (and headings and
other pretty stuff) the totals are always visible no matter where the user
scrolls. Window - Freeze panes. SOme people get all squirmy at the idea of
having totals at the top, probably because when they were taught to add they
put the sum at the bottom, and that's the way it is. Ever shall be.
They'll come around. It works great.

If you still want to build formulas in a macro, here's some stuff:

Put one of these in a regular module:

Sub AutoSum()
'Creates =SUM() formula in cell immediately below selection. Users first
selects cells to sum
ActiveSheet.Unprotect Password:="mypass"
Cells(Selection.Row + Selection.Rows.Count, Selection.Column).Formula = _
"=SUM(" & Selection.Address & ")"
ActiveSheet.Protect Password:="mypass"
End Sub

Sub AutoSum2()
Creates =SUM() formula from active cell to top of region containing data
Dim Contents As String
ActiveSheet.Unprotect Password:="mypass"
Contents = Range(Selection.Offset(-1, 0), Selection.Offset(-1,
0).End(xlUp)).Address
ActiveCell = "=SUM(" & Contents & ")"
ActiveSheet.Protect Password:="mypass"
End Sub

Sub AutoSum3()
Creates =SUM() formula from top of worksheet to activecell
Dim Contents As String
ActiveSheet.Unprotect Password:="mypass"
Contents = Range(Selection.Offset(-1, 0), Cells(1,
Selection.Column)).Address
ActiveCell = "=SUM(" & Contents & ")"
ActiveSheet.Protect Password:="mypass"
End Sub

The user makes a selection and clicks a button you've created on a toolbar
to run the macro. It's probably a bit user-error-prone. It's a start.

You can use View - Toolbars - Customize to create toolbars and make your own
buttons, and the right-click on a button you've created to draw a face on it
and assign it to your macro.
--
Earl Kiosterudwww.smokeylake.com
-----------------------------------------------------------------------"CAPTGNVR" wrote in ooglegroups.com...



D/EARL


The problem is if i unprotect the sheet in macro- then users might del
a row or formulas by mistake. So let me know if it can be done. I am
now trying to make this confusing relative and absolute ref in macro
and give a button image resembling 'auto sum'. I will also have
problems in writing the code in VB how to make the program know how
many cells from active cell to top to take. Your advice pls.


On Jan 30, 6:35 am, "Earl Kiosterud" wrote:
Captgnvr,


I don't think there's a direct way to enable the autosum button on a
protected sheet. You could have your own macro do this, and could be run
by
any button you create on any toolbar.


--
Earl Kiosterudwww.smokeylake.com
-----------------------------------------------------------------------"CAPTGNVR"
wrote in
oglegroups.com...


D/EARL
Thnks ur feedback. I was wanting the autosum button which is disabled
in a protected sheet. Want to know if there are means to have a vb to
get this button enabled.


On Jan 30, 3:15 am, "Earl Kiosterud" wrote:
Capt,


If you're referring to the quick calculate thing on the status bar
that
instantly sums selected cells, it works with a protected sheet. The
protection (Tools - Protection - Protect Sheet) has to have allowed
cell
selection.


If you mean the Autosum button that puts =SUM(hethere) into a cell,
you
can't do that in a protected sheet; the Autosum button is disabled.
You
could do it manually by typing =SUM( then dragging your range, then
type
the
closing ).
--
Earl Kiosterudwww.smokeylake.com
-----------------------------------------------------------------------"CAPTGNVR"
wrote in
oglegroups.com...


Dear Programmers


I have some group of cells which keeps varying and would be nicer to
have the AUTOSUM on a protected sheet. Pls suggest


BRGDS/CAPT GN VENKAT RAJARAM


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
Down arrow moves cursor to top of worksheet when sheet protected Bill Williams Excel Worksheet Functions 0 April 29th 06 06:37 PM
is it possible to use macros when the sheet is protected Dajana Excel Discussion (Misc queries) 1 September 23rd 05 03:08 AM


All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"