• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Lock Cells

delta

Member
In sheet name "Bill"

except cell range A2, C2,B5, B10, D7, E6, H10,

all cell will not be selected (user do not select any cell except above cell range)

user must select above cell rang only.

it is made by only for macro

not manually

it is possible by worksheet select change event
 
my dear i want only macro


▬▬▬▬▬▬▬▬▬ Mod edit : at least post in appropriate forum !
 
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.EnableEvents = False
    Select Case Target.Address
        Case "$A$2", "$C$2", "$B$10", "$D$7", "$E$6", "$H$10"
            x = x
        Case Else
            Sheets("Bill").Range("B2").Select
    End Select
    Application.EnableEvents = True
End Sub
 
record macro will not working when activate other sheet and then activate sheet Bill activate the error message shown
 
humm?
In sheet name "Bill"
except cell range A2, C2,B5, B10, D7, E6, H10,
all cell will not be selected (user do not select any cell except above cell range)
user must select above cell rang only.
it is made by only for macro
not manually
it is possible by worksheet select change event

What do You write about 'record macro'?
What kind of message do You get?
There could add one more line...
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Count > 1 Then Sheets("Bill").Range("B2").Select
    Select Case Target.Address
        Case "$A$2", "$C$2", "$B$10", "$D$7", "$E$6", "$H$10"
            x = x
        Case Else
            Sheets("Bill").Range("B2").Select
    End Select
    Application.EnableEvents = True
End Sub
...or is this again something preventing copy&paste case?
This works only case, with which cell can select
as You wanted with 'worksheet select change event'!
... 'paste' will happen AFTER selection!
 
i would like that only cell range A2, C2,B5, B10, D7, E6, H10 will be selected
it means

user enter any value in between A2, C2,B5, B10, D7, E6, H10 cell range only

it means

cursor move only above range only do not move cursor other cell
 
yes i test it

but when alwasy A2 cell is selected i want to enter any value in A2 cell and down key press by keybord still A2 cell selectedd
 
Okay ... You can select A2 (as well as all those cells You have named),
- this works?
Next You would like to as You say enter any value there - yes!
It's a new case!
That means ex You will write A to that cell and
after that You have to press enter-button as You wrote!
or as You did ... You write to cell A and press key down - no problem!
It still works!
Then You press 'key down' ...
it really moves 'one cell down' (to A3) which is not allowed!
All selections which are not within allowed list will make as You notice -
Cell A2 will be active!
Which cell should be active (if use only 'Worksheet_SelectionChange')?
It is possible that 'next active cell' after enter or any other key
would be any of those allowed cells ... with random or with which logic?
 
Back
Top