Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2003 VBA Assistance needed

Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Excel 2003 VBA Assistance needed

Part1 is quite easy:

Sub UnlockUm()
Dim s1 As String
Dim s2 As String
s1 = Evaluate("ADDRESS(DAY(NOW()),2)")
s2 = Evaluate("ADDRESS(DAY(NOW()),9)")
Range(s1 & ":" & s2).Locked = False
End Sub
--
Gary''s Student - gsnu200817


"Tymothé" wrote:

Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Excel 2003 VBA Assistance needed

On 3 Dec, 22:29, Tymothé wrote:
Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.



from Phillip London UK

Copy this code into the Thisworkbook module in the VBA Editor
A quick way to get to the Thisworkbook module is to right click the
Excel icon to the left of the File menu option and select View Code

This will select the range to be edited based on the day but
not allow the user to select any other cells
Save your workbook close it and reopen it for the code to work


Private Sub Workbook_Open()
Dim theday As Integer
Worksheets("sheet1").Select
theday = Day(Date)
SetRange theday
End Sub


Sub SetRange(rw As Integer)
Dim rng As Range
Set rng = Range("B" & rw & ":I" & rw)
rng.Select
With ActiveWindow
.ScrollColumn = 1
.ScrollRow = rw
End With
Worksheets("sheet1").ScrollArea = rng.Address
End Sub









  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel 2003 VBA Assistance needed

Check your other post, too.

Tymothé wrote:

Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel 2003 VBA Assistance needed

Hi, my take on selecting the range is:

activesheet.cells(day(date),2).resize(1,8).select

AC

"Dave Peterson" wrote:

Check your other post, too.

Tymothé wrote:

Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel 2003 VBA Assistance needed

That was very close to my take in the other post, too.

AndrewCerritos wrote:

Hi, my take on selecting the range is:

activesheet.cells(day(date),2).resize(1,8).select

AC

"Dave Peterson" wrote:

Check your other post, too.

Tymothé wrote:

Part 1

I have a spreadsheet that I want to open protected (locked). However, I want
to unlock a specific range for data entry based on the day of the actual
system date.

For example if today is 11/5/08 then we want to unlock row 5, specifically
cells B5:I5.

I have experimented with several functions, which return the desired
results, but I am not skilled enough to place them into a well-written VBA
subroutine.

Please note the following function examples that return the start and ending
cells of the desired range.

=ADDRESS(DAY(NOW()),2) this will display the start cell of the range (B5)
and=ADDRESS(DAY(NOW()),9) will display the last cell in the range (I5).

If anyone could assist with the writing of a subroutine that would select
the whole range, for example;

ADDRESS(DAY(NOW()),2).ADDRESS(DAY(NOW()),9).Select

That would be the first step to my solution.

Part 2

Tying it all together...

Once the range can be selected based on the system date, through code, then
the next task is to either unlock that range for editing or better yet,
utilize the menu command Tools, Protection, Protect and Share Workbook and
should read menu command Tools, Protection, Allow Users to Edit Ranges

So we can allow specific users based on their Active Directory Account to
edit a particular range.

However, at a minimum, opening the sheet unlocked (protected) and saving it
locked (protected) would work.

Thanks in advance for staying up at night working on this.


--

Dave Peterson


--

Dave Peterson
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
Lookup assistance needed HowardM Excel Worksheet Functions 9 December 9th 09 05:13 PM
CODE Assistance needed PLEASE please please N.F[_2_] Excel Discussion (Misc queries) 0 July 9th 07 08:36 PM
Code assistance needed JimMay Excel Programming 5 May 7th 06 11:13 AM
VBA Assistance Needed RalphB Excel Discussion (Misc queries) 5 February 22nd 06 06:16 PM
Macro assistance needed HJ Excel Programming 3 November 2nd 04 10:46 PM


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

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"