Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default activate/deactivate macro depending on who's the user

in my office we have a shared drived folder that is used by different
users,we store excel worksheets in the shared folder. Each user have to log
in to the PC with a different ID to start using the it.

I need a macro to automatically hide/unhide rows in the excel worksheet
depending on who the user is.

How should i write the macro? Please help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default activate/deactivate macro depending on who's the user

Hi Anna

This should get you started

Sub UnHideCols()
Dim user As String
user = Environ("Username")
With Sheets("Sheet1")
' you have to leave at least 1 column visible on a sheet
' so set all but column A as hidden to begin with
Columns("B:IV").EntireColumn.Hidden = True
Select Case user
Case "Anna"
Columns("B:H").EntireColumn.Hidden = False
Case "Roger"
Columns("I:M").EntireColumn.Hidden = False
' add as many other users as you wish, with their
' relevant columns hidden property set to false

Case Else
End Select
End With
End Sub

--
Regards
Roger Govier

"anna" wrote in message
...
in my office we have a shared drived folder that is used by different
users,we store excel worksheets in the shared folder. Each user have to
log
in to the PC with a different ID to start using the it.

I need a macro to automatically hide/unhide rows in the excel worksheet
depending on who the user is.

How should i write the macro? Please help.

__________ Information from ESET Smart Security, version of virus
signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default activate/deactivate macro depending on who's the user

Hi Anna

Sorry, I didn't read your post carefully enough.
You said you wanted to hide Rows, not columns.


--
Regards
Roger Govier

"Roger Govier" <roger@technology4unospamdotcodotuk wrote in message
...
Hi Anna

This should get you started

Sub UnHideCols()
Dim user As String
user = Environ("Username")
With Sheets("Sheet1")
' you have to leave at least 1 column visible on a sheet
' so set all but column A as hidden to begin with
Columns("B:IV").EntireColumn.Hidden = True
Select Case user
Case "Anna"
Columns("B:H").EntireColumn.Hidden = False
Case "Roger"
Columns("I:M").EntireColumn.Hidden = False
' add as many other users as you wish, with their
' relevant columns hidden property set to false

Case Else
End Select
End With
End Sub

--
Regards
Roger Govier

"anna" wrote in message
...
in my office we have a shared drived folder that is used by different
users,we store excel worksheets in the shared folder. Each user have to
log
in to the PC with a different ID to start using the it.

I need a macro to automatically hide/unhide rows in the excel worksheet
depending on who the user is.

How should i write the macro? Please help.

__________ Information from ESET Smart Security, version of virus
signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4802 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4802 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default activate/deactivate macro depending on who's the user

Hi Anna

Sorry, I misread your request. You want to hide Rows, not Columns.

Sub UnHideRows()
Dim user As String
user = Environ("Username")
With Sheets("Sheet1")
' you have to leave at least 1 rowvisible on a sheet
' so set all but column A as hidden to begin with
Rows("2:65536").EntireRow.Hidden = True
Select Case user
Case "Anna"
Rows("2:30").EntireRow.Hidden = False
Case "Roger"
Rows("31:60").EntireRow.Hidden = False
' add as many other users as you wish, with their
' relevant rows hidden property set to false

Case Else
End Select
End With
End Sub


--
Regards
Roger Govier

"Roger Govier" <roger@technology4unospamdotcodotuk wrote in message
...
Hi Anna

This should get you started

Sub UnHideCols()
Dim user As String
user = Environ("Username")
With Sheets("Sheet1")
' you have to leave at least 1 column visible on a sheet
' so set all but column A as hidden to begin with
Columns("B:IV").EntireColumn.Hidden = True
Select Case user
Case "Anna"
Columns("B:H").EntireColumn.Hidden = False
Case "Roger"
Columns("I:M").EntireColumn.Hidden = False
' add as many other users as you wish, with their
' relevant columns hidden property set to false

Case Else
End Select
End With
End Sub

--
Regards
Roger Govier

"anna" wrote in message
...
in my office we have a shared drived folder that is used by different
users,we store excel worksheets in the shared folder. Each user have to
log
in to the PC with a different ID to start using the it.

I need a macro to automatically hide/unhide rows in the excel worksheet
depending on who the user is.

How should i write the macro? Please help.

__________ Information from ESET Smart Security, version of virus
signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4801 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4802 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4802 (20100124) __________

The message was checked by ESET Smart Security.

http://www.eset.com



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
Links is in gray color (deactivate). How can I activate? Rechie Excel Discussion (Misc queries) 6 December 13th 09 11:10 AM
Trying to get a User Form to activate off a drop down menu Rcarper Excel Discussion (Misc queries) 2 October 2nd 09 02:04 PM
Excel crashes depending on user?? Khuli Excel Discussion (Misc queries) 0 June 17th 09 11:04 AM
printing different numbers of rows of results depending on user in ajmaschinot Excel Discussion (Misc queries) 1 August 6th 08 08:53 PM
activate macro Jase Excel Discussion (Misc queries) 1 June 9th 08 08:25 PM


All times are GMT +1. The time now is 09:10 PM.

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

About Us

"It's about Microsoft Excel"