Posts by pantakos

    I don't understand. Are you using VBA to add rows to the Table?


    How are you inputting lines into the invoice?

    Ahhh ! I am sorry . I dont! at the original code there is a limit at 60 rows (including headers etc) . and if they go above Row 70 then ends the script. Because now the items will be many more, this means a lot of rows then I dont need the limit but add a new row if needed. I tried table but no luck! From my previous post


    For example I need to add 20 products (20 rows) but I only have one free row , the starting row 15.

    Then the script to automatically add 19 more rows but keep rows 16-21 (the last 5) untouched as they needed for the totals. So the totals will start at row 36 and rows 15-35 will be filled with data from other sheets. Finally the addedd row will need to have the formula in column D.

    So need to always add more rows depending the amount of products collected from other sheets, not delete the last 5 rows but "push" them down, not overwrite anythink just add rows.


    I need rows 1-14 stable and rows 16-21 be stable , add rows between them. I hope this is clear...

    royUK I tried the solution with the table, but I may do something wrong. It doesnt push down rows and add a new one but it is overwrite the last rows to continue script. My problem is that I dont to overwrite the last 5 rows, but add more rows and continue insert data. I really hope you understand, I know I am getting as tedious and sorry about that, my I am very close to finish this (lets say) project. Thank again.

    Basically what I want to do is

    FORMA sheet has only the below lines as shown in image 1

    For example I need to add 20 products (20 rows) but I only have one free row , the starting row 15.

    Then the script to automatically add 19 more rows but keep rows 16-21 (the last 5) untouched as they needed for the totals. So the totals will start at row 36 and rows 15-35 will be filled with data from other sheets. Finally the addedd row will need to have the formula in column D.

    So need to always add more rows depending the amount of products collected from other sheets, not delete the last 5 rows but "push" them down.

    I hope I explain it correct. Than you for your effort royUK !

    Thank you for the info royUK. I really didnt think of that.

    I will try that later and be back.

    The new row will be blank yes? If I need at column D lets say to sum B+C do I have to place the formula manual? Or there is a way to do it automatically?

    And do I have to delete the check (if n>70) from the code, in order to make table work?

    Hello,


    First of all I have posted the same thread at mrexcel https://www.mrexcel.com/board/…ew-row-if-needed.1198559/

    And here is my question and needed help.


    First of all I need to say thank you to all of you that have helped me and write (tried and did) the below code.

    The code is working perfectly!. What the code do is that it collect data from 3 or more sheets and insert them to another sheet in order to create an invoice. So far , so good.

    The problem is that there is an alert if the inserted data are more than row 70 to end sub. Now there is the need to incremental add rows to invoice and not checking if they are more than 70.

    Starts from Row 15 and add row if there is a need (ie retrieve more data from sheets and copy them). I have tried to make it happen using a tutorial from VBA Macro to Insert Row in Excel Based on https://www.exceldemy.com/exce…rt-row-based-on-criteria/ but no luck.

    Also the row must have columns A B C and D has a formula (B*C) .Can someone please help to make this work?


    You can find at the example workbook. The module needed to change is Invoice



    Thank you!


    royUK a put this code and I think it is working. I placed it in Hide


    Code
        For Each oWs In ThisWorkbook.Worksheets
            oWs.Unprotect sPw
                'Cells.Locked = True
                oWs.Columns(xAddress).Locked = False
                oWs.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
            oWs.Protect sPw
             Next oWs

    X/

    As I understand (I havent tested the code as I dont have my pc here) I cant hide and at the same time leave the cells unprotected for editing. You se the scenario is that the workgroup maybe protected but it is needed to enter data in order the macros to work and create the invoice. My manager needs to sent excel to technicians to full BOOK cell but they cant see the DAILY RATE cell. Thats why I am trying to figure out a way to fo that. Thats the idea. I hope you understand. Thank you for your effort!

    Thank you royUK for all the effort and Help.

    I managed to lock or unlock , hide or not sheets or columns.

    I am trying to make a locked sheet, to just leave edit cells open in order to can make some changes.

    I am "playing" with


    But cannot find the combination in order to allow edit cells but NOT be able to change column width. Is that possible? I undestand that the sheet must be already protected (right?) and then try the above script. I will upload the whole excel file in order to understand (if you have the time) my thoughts.


    Thank you !

    Yes, you are absolutely correct. You see, there are a lot if macro running that collect data from various colums, sheets etc. So if I protect the whole sheet then the macro is not working and got errors, access denied. Thats my problem

    The idea is to only (try) to lock certain Column (by not changing width). I can make it hidden, but I was having problem make the sheet protected only by changing width (I need to can edit it). Basically I dont user can change width, so thats why I needed to lock width. I maybe hidden but a user can change width and reveal hidden data.

    This do what I need.


    Thank you all and apologies for misunderstandings.

    Ok, you are right. Sorry for my ignorance, but I just want to hide the column by decrease width and not let anyone can change the width in order to see the data. I dont want to be super hidden (my mistake, wrong title etc). I have this code


    Code
    SPsheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
     False, AllowFormattingCells:=True, AllowFormattingRows:=True, _
     AllowInsertingHyperlinks:=True, AllowSorting:=True, AllowFiltering:=True _
     , AllowUsingPivotTables:=True

    that I think that this will do the trick and can put it in Case so asks for password in order to let someone play with width or not.

    The problem is that it doesnt let me use a column (ie D) or even range.

    This is what I am asking for. Help about that issue (and NOT superhidden as I undetstand this cant be done).

    I hope you understand (my English are not that good)


    Thank you