Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:02:38+00:00 2026-05-27T11:02:38+00:00

I would like for the user to only be allowed to input values into

  • 0

I would like for the user to only be allowed to input values into the cells listed below in the following order:

D3,C3,B9,B3,E2,D4,G4,I4,D5,G5,I5,D6,G6,I6,D7,G7,I7,D8,G8 and I8.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:02:39+00:00Added an answer on May 27, 2026 at 11:02 am

    Open excel and select the cells mentioned by you. You can do this by keeping Ctrl key pressed while selecting the cells. Now right click and select format cells and go to the protection tab. In the protection tab, uncheck the Locked check box. Now protect the sheet and make sure that you check the option ‘Select Unlocked Cells’ (second checkbox in the list)

    Here is the code to control the order using vba

    1. Right-click on the sheet1 tab and “View Code”.

    2. Paste the following code into that sheet module.

      Private Sub Worksheet_Change(ByVal Target As Excel.Range)
      On Error GoTo enditall
      Application.EnableEvents = False
      i = Array("D3", "C3", "B9", "B3", "E2", "D4", "G4", "I4", "D5", "G5", "I5", "D6", "G6", "I6", "D7", "G7", "I7", "D8", "G8", "I8")
      k = Replace(Target.Cells.Address, "$", "")
      If k = i(j) Then
      Sheet1.Unprotect
      Sheet1.Range(i(j)).Locked = True
      Sheet1.Range(i(j + 1)).Locked = False
      Sheet1.Range(i(j + 1)).Select
      j = j + 1
      Sheet1.Protect
      End If
      enditall:
      Sheet1.Protect
      Application.EnableEvents = True
      End Sub
      
    3. Now right click on sheet1 in the same window and select insert. From the insert menu click on Module. Now select the create module and paste the following code.

      Public j
      
      Sub Settings()
      j = 0
      Sheet1.Unprotect
      Sheet1.Cells.Locked = True
      Sheet1.Range("D3").Locked = False
      Sheet1.Range("D3").Select
      Sheet1.Protect
      End Sub
      
    4. Now run the macro settings every time you want to enter data to your sheet.

    Here is the commented version of the code

    'The code below should come in a module and should be run every time a change is required in the sheet
    Public j 'declaring j as a public variable so that it can be accessed from any procedure in the excel project
    
    Sub Settings()
    j = 0 'sets j as zero
    Sheet1.Unprotect 'unprotect the sheet
    Sheet1.Cells.Locked = True 'locks all the cells in the sheet
    Sheet1.Range("D3").Locked = False 'unlocks the first cell D3 and makes it editable
    Sheet1.Range("D3").Select 'selects the cell D3
    Sheet1.Protect 'reprotects the sheet
    End Sub
    
    
    
    'Following code should be entered in the code of sheet where the values need to be entered
    Private Sub Worksheet_Change(ByVal Target As Excel.Range) 'the code runs when a cell in the excel sheet is changed
    On Error GoTo enditall 'this handles error
    Application.EnableEvents = False 'excel events are disabled
    i = Array("D3", "C3", "B9", "B3", "E2", "D4", "G4", "I4", "D5", "G5", "I5", "D6", "G6", "I6", "D7", "G7", "I7", "D8", "G8", "I8") 'array with cells in order
    k = Replace(Target.Cells.Address, "$", "") 'finds the cell address where the change was made
    If k = i(j) Then 'checks whether the change was made in a cell in the array, we set the value of j to zero by running the macro settings shown below
    Sheet1.Unprotect 'unprotects the sheet to make the changes
    Sheet1.Range(i(j)).Locked = True 'makes the correspondig cell in the array locked after editing
    Sheet1.Range(i(j + 1)).Locked = False 'unlocks the next cell in the array
    Sheet1.Range(i(j + 1)).Select 'selects the next cell in the array
    j = j + 1 'increments the value of j by 1
    Sheet1.Protect 'reprotects the sheet
    End If
    enditall: 'the code below will run on an error, this code will run when value of j becomes more than the number of elements in array k
    Sheet1.Protect 'protect the sheet
    Application.EnableEvents = True 'enables excel events
    End Sub
    

    See the sample file at https://docs.google.com/open?id=0B3mN8H2AV4UCN2E5ZWMxNjEtMGZiZS00NzYzLWI2NDUtOTdmZjg3YzcyNGUw

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIScrollView with only horizontal scrolling allowed, and I would like to
I'm using Authlogic with my Ruby on Rails App. I would like user to
I would like the user to select the time in javascript and to avoid
I would like the user to add several pins to a map to represent
I would like the user to be able to edit the title of the
I'm developing an ASP.NET Web app and would like the user to be able
My app displays a list of albums and I would like the user to
I’m developing an application dedicated to generate statistical reports, I would like that user
I would like to create a user interface like the iGoogle or facebook profiles
I would like to embed user-specific data on-the-fly when distributing an APK from my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.