Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-27 Thread Paul Schreiner
I'm not sure what I'm looking at here with:
'--
CODE
B_n:Cells(Frow, Fcol).Select' force location
Tytle = Enter charges:
'---
 
On 10/22 You had written:
 
Attempted to try:
Private Sub Workbook_SheetSelectionChange( ByVal WkSh As Object, ByVal AmAt As 
Excel.Range) 

So, I assumed you were using VBA (since this is the Excel VBA 
SheetSelectionChange event)
But the CODE \CODE syntax isn't VBA, so nothing I said would apply.

sorry.

Paul
-
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-

 From: Robert Baer robertgurrb...@gmail.com
To: excel-macros@googlegroups.com 
Cc: schreiner_p...@att.net 
Sent: Saturday, October 25, 2014 1:02 PM
Subject: Re: $$Excel-Macros$$ Re: How can one control data entry and truly 
protect a verified entry
  


  Color me confused.

  SheetSelectionChange event? where?
  This is a typical input i have:

CODE
B_n:Cells(Frow, Fcol).Select' force location
Tytle = Enter charges:
Avar = Application.InputBox(Tytle)  ' returns type text
If Avar = FALSE Then GoTo B_n
ActiveCell.FormulaR1C1 = Val(Avar)
Chrg = Val(Avar): ColChg = ColChg + Chrg
Fcol = Fcol + 1 '$C$9
\CODE

  I control Frow and Fcol,which does the locking i wanted,as user cannot
do anything except input data exactly where i want.
  I save the row data at the end, and give options at the start for what
is next.

  Now,it would be useful to be able to position that input box, as well as 
 change the font of the text in the box.
  And, i think lastly, have the app automatically run when the XLS program is 
 launched.

  Thanks,
Robert Baer

PS: have yet to test the FALSE part (ie: one clicks on Cancel in the
 input box.
 

On Wednesday, October 22, 2014 11:41:41 AM UTC-7, Paul Schreiner wrote:
I hate to throw a wrench into the monkeyworks, but:

you were trying to use the SheetSelectionChange event.
which actually runs for ANY sheet in your workbook, not just a specific sheet.

which might be a bit confusing if you have multiple sheets,
and you're using the event macro to lock the cells, then it would actually 
lock the cells the other sheets as well..

Private Sub Workbook_SheetSelectionChange( ByVal Sh As Object, ByVal Target 
As Range)

If you only want the macro to run on a specific sheet, you can either test 
the Sh object for the sheet name.
Or you can create a similar event macro in the sheet module called:

Private Sub Worksheet_SelectionChange( ByVal Target As Range)

Next, if you're wanting to lock cells A1:P9, you could use something like:

Private Sub Workbook_SheetSelectionChange( ByVal Sh As Object, ByVal Target 
As Range)
Dim Targ As Range
For Each Targ In Target
If (Not Intersect(Targ, Sh.Range(A1:P8)) Is Nothing) Then
Sh.Range(A9).Select
Exit For
End If
Next Targ
End Sub

One thing I've run into is that if you select multiple cells, the Target 
variable becomes an array instead of a simple object.
So I use the Targ variable to loop through the Target selection array.
This works if you select a single cell or multiple.

In this case, I look for the intersection of the selected cell and the 
locked range.
If the cell is within the blocked range, it returns the range.
(or Not nothing)

in which case I selce another cell (which, incidentally calls this event 
again)

The nice thing about this is that if you wish to change the values of the 
blocked cells using VBA, you don't actually select the cell, you simply 
have to use something like:

Range(A2).value = Test

something else you need to be aware of is that the Target variable 
a range variable, but the address is in absolute terms.
That is, if you select cell A9, Target.Address is $A$9

So, if you want to test to see if the selected cell is A9, you could use 
either:

If (Targ.Address = $A$9) then

or even:

If (Targ.Row = 9) and (Targ.Column = 1) then

Paul
-- ---
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-- ---


 From: Robert Baer robertg...@gmail.com
To: excel-...@googlegroups.com 
Sent: Wednesday, October 22, 2014 12:57 PM
Subject: Re: $$Excel-Macros$$ Re: How can one control data entry and truly 
protect a verified entry
  


  WOW!
  That works!
  Thanks a lot!
  Attempted to try:
Private Sub Workbook_SheetSelectionChange( ByVal WkSh As Object, ByVal AmAt 
As Excel.Range)
 ' Supposedly runs when a sheet selection (cell?) is changed.
whatName = WkSh.Name: wheregot = AmAt
If wheregot  CellLoc Then
 X = X  ' set as a breakpont; NEVER happens

Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-25 Thread Robert Baer
  Color me confused.

  SheetSelectionChange event? where?
  This is a typical input i have:

CODE
B_n:Cells(Frow, Fcol).Select' force location
Tytle = Enter charges:
Avar = Application.InputBox(Tytle)  ' returns type text
If Avar = FALSE Then GoTo B_n
ActiveCell.FormulaR1C1 = Val(Avar)
Chrg = Val(Avar): ColChg = ColChg + Chrg
Fcol = Fcol + 1 '$C$9
\CODE

  I control Frow and Fcol,which does the locking i wanted,as user cannot
do anything except input data exactly where i want.
  I save the row data at the end, and give options at the start for what
is next.

  Now,it would be useful to be able to position that input box, as well as 
change the font of the text in the box.
  And, i think lastly, have the app automatically run when the XLS program 
is launched.

  Thanks,
Robert Baer

PS: have yet to test the FALSE part (ie: one clicks on Cancel in the
 input box.
 

On Wednesday, October 22, 2014 11:41:41 AM UTC-7, Paul Schreiner wrote:

 I hate to throw a wrench into the monkeyworks, but:
  
 you were trying to use the SheetSelectionChange event.
 which actually runs for ANY sheet in your workbook, not just a specific 
 sheet.
  
 which might be a bit confusing if you have multiple sheets,
 and you're using the event macro to lock the cells, then it would 
 actually lock the cells the other sheets as well..
  
 Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target 
 As Range)
  
 If you only want the macro to run on a specific sheet, you can either test 
 the Sh object for the sheet name.
 Or you can create a similar event macro in the sheet module called:
  
 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  
 Next, if you're wanting to lock cells A1:P9, you could use something 
 like:
  
 Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target 
 As Range)
 Dim Targ As Range
 For Each Targ In Target
 If (Not Intersect(Targ, Sh.Range(A1:P8)) Is Nothing) Then
 Sh.Range(A9).Select
 Exit For
 End If
 Next Targ
 End Sub
  
 One thing I've run into is that if you select multiple cells, the Target 
 variable becomes an array instead of a simple object.
 So I use the Targ variable to loop through the Target selection array.
 This works if you select a single cell or multiple.
  
 In this case, I look for the intersection of the selected cell and the 
 locked range.
 If the cell is within the blocked range, it returns the range.
 (or Not nothing)
  
 in which case I selce another cell (which, incidentally calls this event 
 again)
  
 The nice thing about this is that if you wish to change the values of the 
 blocked cells using VBA, you don't actually select the cell, you simply 
 have to use something like:
  
 Range(A2).value = Test
  
 something else you need to be aware of is that the Target variable 
 a range variable, but the address is in absolute terms.
 That is, if you select cell A9, Target.Address is $A$9
  
 So, if you want to test to see if the selected cell is A9, you could use 
 either:
  
 If (Targ.Address = $A$9) then
  
 or even:
  
 If (Targ.Row = 9) and (Targ.Column = 1) then
  
 *Paul*
 -







 *“Do all the good you can,By all the means you can,In all the ways you 
 can,In all the places you can,At all the times you can,To all the people 
 you can,As long as ever you can.” - John Wesley*
 -

*From:* Robert Baer robertg...@gmail.com javascript:
 *To:* excel-...@googlegroups.com javascript: 
 *Sent:* Wednesday, October 22, 2014 12:57 PM
 *Subject:* Re: $$Excel-Macros$$ Re: How can one control data entry and 
 truly protect a verified entry
  
   WOW!
   That works!
   Thanks a lot!
   Attempted to try:
 Private Sub Workbook_SheetSelectionChange(ByVal WkSh As Object, ByVal AmAt 
 As Excel.Range)
  ' Supposedly runs when a sheet selection (cell?) is changed.
 whatName = WkSh.Name: wheregot = AmAt
 If wheregot  CellLoc Then
  X = X  ' set as a breakpont; NEVER happens
 End If
 End Sub
   ..which never executed, so that idea was DOA.

   The Application.InputBox() is perfect.
   Thanks again.

 On Wednesday, October 22, 2014 2:00:11 AM UTC-7, Vabz wrote:

 you can use this to work on VBA

 Sub RB()

 Dim Avar As String, Nvar As Long
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = Application.InputBox(Enter value!!, Type:=3)
 ' want to wait for user entry; obviously i now have a wait working, 
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend
 
 End Sub


 +
 *I did not do this for you. God is here working through me for you.*

 On Tue, Oct 21, 2014 at 12

Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-22 Thread Vaibhav Joshi
you can use this to work on VBA

Sub RB()

Dim Avar As String, Nvar As Long
Dim Frow As Integer, Fcol As Integer
' Start row data entry
Frow = 9: Fcol = 1 ' aka A
Cells(Frow, Fcol).Select
Avar = Application.InputBox(Enter value!!, Type:=3)
' want to wait for user entry; obviously i now have a wait working,
BUT.
' stays in this loop forever; user CANNOT enter anything!
ActiveCell.FormulaR1C1 = UCase$(Avar)
Fcol = Fcol + 1 'now $B$9
Nvar = 0
While Nvar = 0
 Nvar = ActiveCell.FormulaR1C1
 ' check alfa?
Wend

End Sub


+
*I did not do this for you. God is here working through me for you.*

On Tue, Oct 21, 2014 at 12:39 AM, Robert Baer robertgurrb...@gmail.com
wrote:



 On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote:

 Hi can you share sample files...

 +


 Here is what i have so far..present question imbedded
 Dim Avar As String, Nvar As Integer
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = 
 While Avar = 
 ' CellLoc = ActiveCell.Address  ' eg: $A$9
  Avar = ActiveCell.FormulaR1C1  ' eg: user enters 88

 ' want to wait for user entry; obviously i now have a wait working,
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!

 Wend
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend


 x = x '-- Justin Case break point for debugging
 ** Thanks

 --
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
 https://www.facebook.com/discussexcel

 FORUM RULES

 1) Use concise, accurate thread titles. Poor thread titles, like Please
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.

 NOTE : Don't ever post confidential data in a workbook. Forum owners and
 members are not responsible for any loss.
 ---
 You received this message because you are subscribed to the Google Groups
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to excel-macros+unsubscr...@googlegroups.com.
 To post to this group, send email to excel-macros@googlegroups.com.
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/d/optout.


-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


macro for RB.xlsb
Description: application/vnd.ms-excel.sheet.binary.macroenabled.12


Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-22 Thread Vaibhav Joshi
see this file..

+
*I did not do this for you. God is here working through me for you.*

On Wed, Oct 22, 2014 at 2:29 PM, Vaibhav Joshi v...@vabs.in wrote:

 you can use this to work on VBA

 Sub RB()

 Dim Avar As String, Nvar As Long
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = Application.InputBox(Enter value!!, Type:=3)
 ' want to wait for user entry; obviously i now have a wait working,
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend

 End Sub


 +
 *I did not do this for you. God is here working through me for you.*

 On Tue, Oct 21, 2014 at 12:39 AM, Robert Baer robertgurrb...@gmail.com
 wrote:



 On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote:

 Hi can you share sample files...

 +


 Here is what i have so far..present question imbedded
 Dim Avar As String, Nvar As Integer
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = 
 While Avar = 
 ' CellLoc = ActiveCell.Address  ' eg: $A$9
  Avar = ActiveCell.FormulaR1C1  ' eg: user enters 88

 ' want to wait for user entry; obviously i now have a wait working,
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!

 Wend
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend


 x = x '-- Justin Case break point for debugging
 ** Thanks

 --
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
 https://www.facebook.com/discussexcel

 FORUM RULES

 1) Use concise, accurate thread titles. Poor thread titles, like Please
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.

 NOTE : Don't ever post confidential data in a workbook. Forum owners and
 members are not responsible for any loss.
 ---
 You received this message because you are subscribed to the Google Groups
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to excel-macros+unsubscr...@googlegroups.com.
 To post to this group, send email to excel-macros@googlegroups.com.
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/d/optout.




-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


macro for RB.xlsb
Description: application/vnd.ms-excel.sheet.binary.macroenabled.12


Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-22 Thread Robert Baer
  WOW!
  That works!
  Thanks a lot!
  Attempted to try:
Private Sub Workbook_SheetSelectionChange(ByVal WkSh As Object, ByVal AmAt 
As Excel.Range)
 ' Supposedly runs when a sheet selection (cell?) is changed.
whatName = WkSh.Name: wheregot = AmAt
If wheregot  CellLoc Then
 X = X  ' set as a breakpont; NEVER happens
End If
End Sub
  ..which never executed, so that idea was DOA.

  The Application.InputBox() is perfect.
  Thanks again.

On Wednesday, October 22, 2014 2:00:11 AM UTC-7, Vabz wrote:

 you can use this to work on VBA

 Sub RB()

 Dim Avar As String, Nvar As Long
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = Application.InputBox(Enter value!!, Type:=3)
 ' want to wait for user entry; obviously i now have a wait working, 
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend
 
 End Sub


 +
 *I did not do this for you. God is here working through me for you.*

 On Tue, Oct 21, 2014 at 12:39 AM, Robert Baer robertg...@gmail.com 
 javascript: wrote:



 On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote:

 Hi can you share sample files...

 +


 Here is what i have so far..present question imbedded
 Dim Avar As String, Nvar As Integer
 Dim Frow As Integer, Fcol As Integer
 ' Start row data entry
 Frow = 9: Fcol = 1 ' aka A
 Cells(Frow, Fcol).Select
 Avar = 
 While Avar = 
 ' CellLoc = ActiveCell.Address  ' eg: $A$9
  Avar = ActiveCell.FormulaR1C1  ' eg: user enters 88

 ' want to wait for user entry; obviously i now have a wait working, 
 BUT.
 ' stays in this loop forever; user CANNOT enter anything!

 Wend
 ActiveCell.FormulaR1C1 = UCase$(Avar)
 Fcol = Fcol + 1 'now $B$9
 Nvar = 0
 While Nvar = 0
  Nvar = ActiveCell.FormulaR1C1
  ' check alfa?
 Wend
 
 
 x = x '-- Justin Case break point for debugging 
 ** Thanks

 -- 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
 https://www.facebook.com/discussexcel
  
 FORUM RULES
  
 1) Use concise, accurate thread titles. Poor thread titles, like Please 
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security 
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.
  
 NOTE : Don't ever post confidential data in a workbook. Forum owners and 
 members are not responsible for any loss.
 --- 
 You received this message because you are subscribed to the Google Groups 
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to excel-macros...@googlegroups.com javascript:.
 To post to this group, send email to excel-...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/d/optout.




-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-22 Thread Paul Schreiner
I hate to throw a wrench into the monkeyworks, but:
 
you were trying to use the SheetSelectionChange event.
which actually runs for ANY sheet in your workbook, not just a specific sheet.
 
which might be a bit confusing if you have multiple sheets,
and you're using the event macro to lock the cells, then it would actually 
lock the cells the other sheets as well..
 
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As 
Range)
 
If you only want the macro to run on a specific sheet, you can either test the 
Sh object for the sheet name.
Or you can create a similar event macro in the sheet module called:
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Next, if you're wanting to lock cells A1:P9, you could use something like:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As 
Range)
Dim Targ As Range
For Each Targ In Target
If (Not Intersect(Targ, Sh.Range(A1:P8)) Is Nothing) Then
Sh.Range(A9).Select
Exit For
End If
Next Targ
End Sub

One thing I've run into is that if you select multiple cells, the Target 
variable becomes an array instead of a simple object.
So I use the Targ variable to loop through the Target selection array.
This works if you select a single cell or multiple.

In this case, I look for the intersection of the selected cell and the 
locked range.
If the cell is within the blocked range, it returns the range.
(or Not nothing)

in which case I selce another cell (which, incidentally calls this event again)

The nice thing about this is that if you wish to change the values of the 
blocked cells using VBA, you don't actually select the cell, you simply 
have to use something like:

Range(A2).value = Test

something else you need to be aware of is that the Target variable 
a range variable, but the address is in absolute terms.
That is, if you select cell A9, Target.Address is $A$9

So, if you want to test to see if the selected cell is A9, you could use either:

If (Targ.Address = $A$9) then

or even:

If (Targ.Row = 9) and (Targ.Column = 1) then

Paul
-
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-

 From: Robert Baer robertgurrb...@gmail.com
To: excel-macros@googlegroups.com 
Sent: Wednesday, October 22, 2014 12:57 PM
Subject: Re: $$Excel-Macros$$ Re: How can one control data entry and truly 
protect a verified entry
  


  WOW!
  That works!
  Thanks a lot!
  Attempted to try:
Private Sub Workbook_SheetSelectionChange(ByVal WkSh As Object, ByVal AmAt As 
Excel.Range)
 ' Supposedly runs when a sheet selection (cell?) is changed.
whatName = WkSh.Name: wheregot = AmAt
If wheregot  CellLoc Then
 X = X  ' set as a breakpont; NEVER happens
End If
End Sub
  ..which never executed, so that idea was DOA.

  The Application.InputBox() is perfect.
  Thanks again.

On Wednesday, October 22, 2014 2:00:11 AM UTC-7, Vabz wrote:
you can use this to work on VBA


Sub RB()


Dim Avar As String, Nvar As Long
Dim Frow As Integer, Fcol As Integer
' Start row data entry
Frow = 9: Fcol = 1 ' aka A
Cells(Frow, Fcol).Select
Avar = Application.InputBox(Enter value!!, Type:=3)
' want to wait for user entry; obviously i now have a wait working, 
 BUT.
' stays in this loop forever; user CANNOT enter anything!
ActiveCell.FormulaR1C1 = UCase$(Avar)
Fcol = Fcol + 1 'now $B$9
Nvar = 0
While Nvar = 0
 Nvar = ActiveCell.FormulaR1C1
 ' check alfa?
Wend

End Sub




+
I did not do this for you. God is here working through me for you.
 

On Tue, Oct 21, 2014 at 12:39 AM, Robert Baer robertg...@gmail.com wrote:



On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote:
Hi can you share sample files...


+



Here is what i have so far..present question imbedded
Dim Avar As String, Nvar As Integer
Dim Frow As Integer, Fcol As Integer
' Start row data entry
Frow = 9: Fcol = 1 ' aka A
Cells(Frow, Fcol).Select
Avar = 
While Avar = 
' CellLoc = ActiveCell.Address  ' eg: $A$9
 Avar = ActiveCell.FormulaR1C1  ' eg: user enters 88

' want to wait for user entry; obviously i now have a wait working, BUT.
' stays in this loop forever; user CANNOT enter anything!

Wend
ActiveCell.FormulaR1C1 = UCase$(Avar)
Fcol = Fcol + 1 'now $B$9
Nvar = 0
While Nvar = 0
 Nvar = ActiveCell.FormulaR1C1
 ' check alfa?
Wend


x = x '-- Justin Case break point for debugging 
** Thanks

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please 
Help

Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-20 Thread Vaibhav Joshi
Hi can you share sample files...

+
*I did not do this for you. God is here working through me for you.*

On Mon, Oct 20, 2014 at 3:34 AM, Robert Baer robertgurrb...@gmail.com
wrote:



 On Saturday, October 18, 2014 8:16:05 PM UTC-7, Robert Baer wrote:

   Assume one has a spreadsheet with some titles and column headings,
 along with a row of data already filled out by an automated copy from a
 previous journal.
   Pardon this is long; think i have given all what i want out of this
 Excel program.

   Assume previous journal (sheet) had a number,want this new one to be
 given (show) in $B$4 the next number. Want $B$3 to be current date. After
 that, want all cells $A$1 to $P$8 to be locked out from any attempt to
 change; better yet, no visiting allowed.
 Input cell at this time is $A$9 and input cell is advanced to $B$9; after
 contents are verified to be integer numeric,then that cell is locked and
 only then input cell is advanced for next entry and that is verified
 according to preset rules for that cell, which is then locked out.
   This continues to right up to and including $I$9; values are calculated
 for cells $J$9 to $P$9; and then all of those cells are locked out.
   At this point,row 9 is locked and this process is repeated for row 10,
 etc to row 33.
  Row 35 accumulates sums for the appropriate columns, and the user is
 locked out from making changes. Row 6 values and row 35 get added into row
 37 and is similarly locked.
   Column K is calculated as a receipt number,incrementing as each row is
 completed by the user. Per rules above, the user is locked out and cannot
 change it.
   Rows not filled out by user remain empty.

   Then a new journal/sheet is made with old row 37 copied to new row 6,
 the journal number is incremented and the locking and forced data entries
 as mentioned continue.

   HOW can this be done (Excel 2003)?

 **  Easily found way to go to a given cell for data entry:
 Range(RowStart).Select.
   However, there seems to be no way to  have the script wait for user
 input (and then check appropriate conditions) before going to next logical
 step.
   If that can be done, it seems i could write the script to do most of
 what i want.
   The locking out i want would seem to be yet another problem.
   Suggestions?
 Thanks.

  --
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
 https://www.facebook.com/discussexcel

 FORUM RULES

 1) Use concise, accurate thread titles. Poor thread titles, like Please
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.

 NOTE : Don't ever post confidential data in a workbook. Forum owners and
 members are not responsible for any loss.
 ---
 You received this message because you are subscribed to the Google Groups
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to excel-macros+unsubscr...@googlegroups.com.
 To post to this group, send email to excel-macros@googlegroups.com.
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/d/optout.


-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-20 Thread Robert Baer


On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote:

 Hi can you share sample files...

 +


Here is what i have so far..present question imbedded
Dim Avar As String, Nvar As Integer
Dim Frow As Integer, Fcol As Integer
' Start row data entry
Frow = 9: Fcol = 1 ' aka A
Cells(Frow, Fcol).Select
Avar = 
While Avar = 
' CellLoc = ActiveCell.Address  ' eg: $A$9
 Avar = ActiveCell.FormulaR1C1  ' eg: user enters 88

' want to wait for user entry; obviously i now have a wait working, BUT.
' stays in this loop forever; user CANNOT enter anything!

Wend
ActiveCell.FormulaR1C1 = UCase$(Avar)
Fcol = Fcol + 1 'now $B$9
Nvar = 0
While Nvar = 0
 Nvar = ActiveCell.FormulaR1C1
 ' check alfa?
Wend


x = x '-- Justin Case break point for debugging 
** Thanks

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


$$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry

2014-10-19 Thread Robert Baer


On Saturday, October 18, 2014 8:16:05 PM UTC-7, Robert Baer wrote:

   Assume one has a spreadsheet with some titles and column headings, along 
 with a row of data already filled out by an automated copy from a previous 
 journal.
   Pardon this is long; think i have given all what i want out of this 
 Excel program.

   Assume previous journal (sheet) had a number,want this new one to be 
 given (show) in $B$4 the next number. Want $B$3 to be current date. After 
 that, want all cells $A$1 to $P$8 to be locked out from any attempt to 
 change; better yet, no visiting allowed.
 Input cell at this time is $A$9 and input cell is advanced to $B$9; after 
 contents are verified to be integer numeric,then that cell is locked and 
 only then input cell is advanced for next entry and that is verified 
 according to preset rules for that cell, which is then locked out.
   This continues to right up to and including $I$9; values are calculated 
 for cells $J$9 to $P$9; and then all of those cells are locked out.
   At this point,row 9 is locked and this process is repeated for row 10, 
 etc to row 33.
  Row 35 accumulates sums for the appropriate columns, and the user is 
 locked out from making changes. Row 6 values and row 35 get added into row 
 37 and is similarly locked.
   Column K is calculated as a receipt number,incrementing as each row is 
 completed by the user. Per rules above, the user is locked out and cannot 
 change it.
   Rows not filled out by user remain empty.

   Then a new journal/sheet is made with old row 37 copied to new row 6, 
 the journal number is incremented and the locking and forced data entries 
 as mentioned continue.

   HOW can this be done (Excel 2003)?

**  Easily found way to go to a given cell for data entry: 
Range(RowStart).Select.
  However, there seems to be no way to  have the script wait for user input 
(and then check appropriate conditions) before going to next logical step.
  If that can be done, it seems i could write the script to do most of what 
i want.
  The locking out i want would seem to be yet another problem.
  Suggestions?
Thanks.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.