+ Reply to Thread
Results 1 to 7 of 7

Copy Cell Statically

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-12-2015
    Location
    Okinawa, Japan
    MS-Off Ver
    2013
    Posts
    178

    Copy Cell Statically

    Greetings All,

    I am trying to copy cell (A2) statically to (D2) on the same sheet (workbook attached) if certain criteria are met. What I want to happen is this: User inputs their name in cell (A2). Next, if they toggle the checkbox (B2) to turn (C2=TRUE) and click the Input Button, then their name will copy to (D2). If the checkbox is not toggled (C2=FALSE), then MSGBOX appears asking them to check the box. However I only want the copy function to happen once...if they change the value in (A2) and do the process again, cell (D2) will retain the original value and not update.

    I hope I have explained this well enough...as usual, in my mind it make perfect sense.

    As always, your help and guidance is appreciated.

    Ken
    Attached Files Attached Files

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,790

    Re: Copy Cell Statically

    This seems pretty simple which leads me to the question of where do you really want to get with this?

    A lot of times people ask for something like what you have and when they get it they say well my data doesn't exactly look like that or how do I make it work with all the sheets in my workbook?

    They keep adding details later.

    The coder and the requester go back and forth many times when it could have been done all in one shot if the requester had laid it all out in the beginning.
    Last edited by skywriter; 10-12-2015 at 02:52 AM.

  3. #3
    Forum Contributor
    Join Date
    09-12-2015
    Location
    Okinawa, Japan
    MS-Off Ver
    2013
    Posts
    178

    Re: Copy Cell Statically

    Hey Skywriter,

    Thank you for the interest. I am trying to assign one student to one workbook by way of their name which will show up on the sheet. I don't want the user to input data and then copy the workbook for a friend who can then pass off the work as their own. I am trying to prevent plagiarism and have each student do their own work.

    If you have any other ideas on how best to accomplish this, I am absolutely open to ideas and suggestions...this was my first thought on a solution.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,790

    Re: Copy Cell Statically

    It sounds more like you should lock all the cells on the workbook until they enter a name and then unlock all the cells except where they put the name.
    You would also want to lock the code so they can't access it.
    Excel from what I understand is not very secure. I'm not a hacker, but I've heard there are programs available that can do it, maybe easily, but like I said I'm not a hacker so I may be completely wrong.
    If they have to logon as a certain user there are ways via code to put their name into the spreadsheet. Maybe in a sheet hidden by code that they don't have access to?
    There are more advanced users than I here, hopefully someone else will chime in with some ideas.

  5. #5
    Forum Contributor
    Join Date
    09-12-2015
    Location
    Okinawa, Japan
    MS-Off Ver
    2013
    Posts
    178

    Re: Copy Cell Statically

    Skywriter,

    Any input on code for my initial idea?

    Thank you.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,790

    Re: Copy Cell Statically

    I marked all the cells as unlocked with the exception of D2. The worksheet was locked and the only option box checked in the protect sheet box was allow the user to select unlocked cells. The password to unlock the sheet is 123, you will see that in the code.

    When the user uses the sheet they will not be able to click into cell D2.

    If they leave A2 blank or fail to check the box they get a message.

    Once D2 has a value in it then the input button will appear to do nothing. In actuality the code is always checking to see if D2 has a value or not. Once there is a value the code will always exit immediately after discovering cell D2 already has a value. D2 is always locked to a user, regardless of whether it is empty or not.

    You should also lock the code.
    While in the code window choose the tools drop down menu, options, protection tab, check the box and enter a password.

    Good Luck.

    Sub Test()
        With Worksheets("Sheet1")
            If .Range("D2") <> "" Then Exit Sub
                If .Range("C2") = True And .Range("A2") <> "" Then
                    .Unprotect Password:=123
                    .Range("D2").Value = .Range("A2").Value
                   .Protect Password:=123
                Else
                    MsgBox "You must enter your name and check the box."
                End If
        End With
    End Sub
    Last edited by skywriter; 10-12-2015 at 02:04 PM.

  7. #7
    Forum Contributor
    Join Date
    09-12-2015
    Location
    Okinawa, Japan
    MS-Off Ver
    2013
    Posts
    178

    Re: Copy Cell Statically

    works great, thank you Skywriter

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Linking Values Statically
    By majime01 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 09-27-2015, 12:01 AM
  2. vba to copy and insert row and copy/paste cell value if cell not blank!
    By GaryDML in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2014, 02:17 AM
  3. Replies: 0
    Last Post: 05-13-2014, 03:03 AM
  4. [SOLVED] How to copy data in a cell in Sheet1 to a cell in Sheet2 using =COPY( )?
    By Mr D Relf in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-17-2013, 10:39 AM
  5. copy a specif cell value, find another like that in sheet copy adjacent cell and pate
    By smwaqas89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2013, 10:00 AM
  6. [SOLVED] copy cell to another cell, increment and copy back.
    By Tathagata in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-18-2012, 07:59 PM
  7. Copy one cell to an other but colors do not copy. While not using clipboard to copy.
    By chuckchuckit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2010, 03:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1