+ Reply to Thread
Results 1 to 11 of 11

VBA Excel Register

  1. #1
    Registered User
    Join Date
    02-09-2016
    Location
    uk
    MS-Off Ver
    2010
    Posts
    38

    VBA Excel Register

    Hello, I would like to know how i could use VBA to offer the next number and fields in a register (see Pic) and lock all of the previous details so they can not be edited after each save. Is this possible?register.png

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA Excel Register

    Not sure what you mean by "off the next number and fields".

    Could you attach a workbook, rather than a pic of one, and show us an example of what needs to be locked?

    BSB

  3. #3
    Registered User
    Join Date
    02-09-2016
    Location
    uk
    MS-Off Ver
    2010
    Posts
    38

    Re: VBA Excel Register

    thanks for the reply. I hope the attached workbook clarifies things.
    Attached Files Attached Files

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA Excel Register

    Here's one quick and easy method.

    Every time you hit save it will unprotect the sheet, update which rows are 'locked' from editing then reapply the protection.

    You could do similar in other ways, for example when you enter a value in the last column of a row it would protect the rows from that point upward, but you could run into issues with that if a user accidentally puts a value in that column.

    Please Login or Register  to view this content.
    Try the attached and see if it works for you as it is. If not we can revisit.

    BSB
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA Excel Register

    Hello. In this model, the sheet is fully protected except for the cells in row 2:

    a) Write in row 2 the information you want, and
    b) Enter the data in listObject by 'clicking' on the button.

    PHP Code: 
    Sub Macro_8()
    Unprotect "myPassword"
      
    ListObjects(1).ListRows.Add.Range Cells(1).CurrentRegion.Rows(2).Value
    Protect 
    "myPassword"TrueTrueTrue, , , , , , , , , , TrueTrue
    End Sub 
    Attached Files Attached Files
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  6. #6
    Registered User
    Join Date
    02-09-2016
    Location
    uk
    MS-Off Ver
    2010
    Posts
    38

    Re: VBA Excel Register

    works perfectly, thanks. The only change I would like, if the report number in the top left that you fill in would automatically be locked with the next sequential number. Is there a way to do this?

  7. #7
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA Excel Register

    Do you think it's OK?...
    Attached Files Attached Files
    Last edited by beyond Excel; 04-27-2023 at 08:19 AM.

  8. #8
    Registered User
    Join Date
    02-09-2016
    Location
    uk
    MS-Off Ver
    2010
    Posts
    38

    Re: VBA Excel Register

    this works great! I have made some tweaks to suit my purpose but i was wondering if there was a line of vba that could clear all of the fields except for the date and report no fields when closing the workbook? I have attached a copy of my progress so far...
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA Excel Register

    Mmm...
    I think you missed post #7: It does exactly that!

  10. #10
    Registered User
    Join Date
    02-09-2016
    Location
    uk
    MS-Off Ver
    2010
    Posts
    38

    Re: VBA Excel Register

    Sorry, you're right. I was struggling trying to get it to work with my newest sheet. A job for tuesday, i reckon. Thanks for your help and have a great weekend.

  11. #11
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA Excel Register

    The same to you.

+ 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. Attendance Register with Excel?
    By hongman in forum Excel General
    Replies: 3
    Last Post: 11-10-2016, 06:03 PM
  2. Microsoft Excel Checkbook Register
    By Ca_Ricky1974 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 04-24-2015, 10:50 AM
  3. [SOLVED] Automatically register new files name into Excel ? Is it possible?
    By pyol17 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-12-2012, 10:52 PM
  4. how to maintain stock register in excel
    By anuragm1990 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-01-2012, 04:39 AM
  5. Replies: 1
    Last Post: 04-10-2012, 09:03 PM
  6. Cash Register with Excel
    By Nasaja in forum Excel General
    Replies: 4
    Last Post: 09-20-2006, 04:53 AM
  7. check register with Excel
    By dbigdog88 in forum Excel General
    Replies: 3
    Last Post: 06-11-2005, 01:05 PM

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