ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Enabling macros while the sheet being protected ! (https://www.excelbanter.com/excel-discussion-misc-queries/30103-enabling-macros-while-sheet-being-protected.html)

dinesh

Enabling macros while the sheet being protected !
 

::Guys,


How to run the macros while the sheet is being protected.

Any ideos.

Please reply me at *::


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


mangesh_yadav


You can still run macros even if the sheet is being protected. By the
way, how are you currently running them. As for you other posts, are
you running the web query though a macro, or have you set it up.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=377989


Pank

Dinesh,

Try the following to unprotect the activesheet:-

..unprotect password:="yourpasswordhere"

To protect the sheet try:-

..protect password:="yourpasswordhere"

HTH

Pank


"mangesh_yadav" wrote:


You can still run macros even if the sheet is being protected. By the
way, how are you currently running them. As for you other posts, are
you running the web query though a macro, or have you set it up.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=377989



dinesh


HI,

I AM GETTING THE FOLLOWING ERROR WHEN I RUN THE MACROS WHILE THE
SHEET BEING PROTECTED.
::-
\\" RUN TIME ERROR '1004' SORT METHOD OF RANGE CLASS FAILED\\"
-

Actually I am refreshing a web query through macro.


& dear pank... I don't know where to put the code.. Please tell
me in detail.
*
Have a Nice Day !
Dinesh Vijaywargiay
*::


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


Dave Peterson

How about just unprotecting the worksheet, run your code and reprotect the
worksheet?

dinesh wrote:

HI,

I AM GETTING THE FOLLOWING ERROR WHEN I RUN THE MACROS WHILE THE
SHEET BEING PROTECTED.
::-
\\" RUN TIME ERROR '1004' SORT METHOD OF RANGE CLASS FAILED\\"
-

Actually I am refreshing a web query through macro.

& dear pank... I don't know where to put the code.. Please tell
me in detail.
*
Have a Nice Day !
Dinesh Vijaywargiay
*::

--
dinesh

------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


--

Dave Peterson

dinesh


UNPROTECTING THE SHEET, RUNNING CODE & AGAIN PROTECTING SHEET..

THAT'S NOT THE SOLUTION.

I REMEMBER THERE IS SOME METHOD OF MODIFYING THE VBA CODE... BY
ENTERING THE PASSWORD IN THE CODE... I AM NOT ABLE TO RECALL


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


tkaplan


modify the code to unprotect the sheet as the first line of the macro
and protect as the last line. a previous post states that code.

hit alt+f11 to open the vba window and add the code to the correct
macro


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=377989


dinesh


::Thanks kaplan.

Is that code correct? I am getting some error.

Can you please modify my code. My code is :

SUB NAME()
'
' NAME MACRO
' MACRO RECORDED 3/14/2005 BY DINESH
'
' KEYBOARD SHORTCUT: CTRL+Q
'
RANGE(\\"A3:AZ28\\").SORT KEY1:=RANGE(\\"A4\\"),
ORDER1:=XLASCENDING, HEADER:= _
XLGUESS, ORDERCUSTOM:=1, MATCHCASE:=FALSE,
ORIENTATION:=XLTOPTOBOTTOM, _
DATAOPTION1:=XLSORTNORMAL
END SUB

Regards,
Dinesh Vijaywargiay::


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


tkaplan


sub name()

..unprotect password:="yourpasswordhere"

...the code that is currently there....

..protect password:="yourpasswordhere"

end sub

make sure you change "yourpasswordhere" to what your password is.


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=377989


dinesh


I AM NOT GETTING IT... DOES THOSE TWO DOTS NEED TO BE THERE...

CAN YOU PLEASE MODIFY MY CODE...

I AM GETTING ERRORS LIKE... 'CAN'T EXECUTE IN BREAKE MODE'
'IDENTIFIER OR BRACKETED EXPRESSION'

I WILL FILL THE PASSWORD FIELD...

REGARDS,
DINESH VIJAYWARGIAY


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


tkaplan


copy and past the following code as is to replace what you currently
have: just change the password field:
sub name()

..unprotect password:="yourpasswordhere"

Range("A3:az28").Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=
_
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

..protect password:="yourpasswordhere"

end sub


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=377989


dinesh


AGAIN GETTING THE SAME ERRORS...(COMPILE ERROR: SYNTAX ERROR) & THERE
IS A YELLOW HIGHLIGHTING ON * SUB NAME()*

I HAVE MANY MACROS IN MY SHEET.... I AM MODIFYING ONLY ONE MACRO..
PROTECTING THE SHEET AND RUNNING ONLY THAT MACRO. DO I NEED TO MODIFY
ALL THE MACROS..

REGARDS,
DINESH VIJAYWARGIAY


--
dinesh


------------------------------------------------------------------------
dinesh's Profile: http://www.excelforum.com/member.php...o&userid=24177
View this thread: http://www.excelforum.com/showthread...hreadid=377989


tkaplan


when it hightlights sub name(), where does it put the mouse curser or
select the text in blue?


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=377989


dominicb


Good evening Dinesh

Why not use this line of code at the start of your module:

ActiveSheet.Protect UserInterfaceOnly:=True

This will allow your macro to make changes to your sheet with the
protection still in place. This will not automatically take effect
every time the workbook is opened, so you would have to tie it to an
event procedure to run it every time the file is used.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=377989



All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com