O
O
Oleg2016-07-15 22:54:34
Visual Basic
Oleg, 2016-07-15 22:54:34

VBA Excel. Creating a macro. How to implement?

Good time.
There is a following task.
There is a price list in excel
Lines 1-3 are not statically scrollable It is
necessary to make a checkbox or radio.
If at least one of the values ​​is selected. the line goes to the output of a new page, where a static page is formed for printing where there will be a header with details and selected lines.
Also, so that the line with the name of the product group, as in the picture "frames for mops", would fall if at least one of the checkboxes is selected. If there is no selected checkbox in the columns WITHOUT VAT or WITH VAT, then this column should not fall into the page generated for printing.
Displaying the total price with and without VAT at the bottom of the columns
I know how to implement this in PHP, JS. But the task is worth doing in excel/
Tell me a resource at least plz, where to read. Superficially understand what needs to be done.
PS Will consider mutual assistance of my knowledge.
65bada6e1f4c4e59bb00c1042a5f0a87.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zelimkhan Beltoev, 2016-07-15
@politon

You need to make a checkbox or radio.

Excel has these elements, but if there are a lot of them on the page (from 50-100), then noticeable lags will appear.
I solved this problem by making checkboxes out of ordinary cells. That is, we somehow mark cells with checkboxes (a separate column, a separate style, a named range, an array with addresses, something else) and hang our handler on the Worksheet_SelectionChange event. In the handler, we check whether the clicked cell is a checkbox and, if it is, check/uncheck the checkbox, if not, we simply skip the event.
Here you still need to think about whether to immediately copy the product to the print page when clicking on the checkbox, or add a copy button so that the user, after all the marks, can "generate" the print page. I am sure, stop at the second option, since it is much easier to implement + there will be no brakes from recalculations when the print page is large.
Duplicate the categories on the print page, make them 0 px high. Along the way, categories can be made named ranges.
If the selected product falls into a hidden category - just make the height > 0 px and add a line with the product below.
Well, this is solved by the usual SUM formula. On VBA it is possible to dynamically generate ranges to it on an input.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question