We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Excel VBA help
InsideInsurance
Posts: 22,460 Forumite
in Techie Stuff
I am a little out of my depth here so hope one of you kind souls will help
I need to create a form in Excel (no choice on that) for a small side project.
On the form I need to have a sub table, each row has a header in Column A, a Checkbox in B and user entered values in C, D & E. At the top of the table is a checkbox which will check/ uncheck all the boxes in the table. There is also a button at the below to add new rows.
The top checkbox is working with no problems.
I dont know how to write the button to add the new row at the bottom of the table and create the checkbox in B
Secondly, I dont know how to write code such that if any of the checkboxes in B are checked (other than the top one) then the user entered data in C-E for that row is deleted. For user inserted rows the same function needs to exist.
If feels that there should be a more sophisticated method than simply repeating the same script for each checkbox (plus I have no idea how to add this to the user inserted one)
Many thanks all
I need to create a form in Excel (no choice on that) for a small side project.
On the form I need to have a sub table, each row has a header in Column A, a Checkbox in B and user entered values in C, D & E. At the top of the table is a checkbox which will check/ uncheck all the boxes in the table. There is also a button at the below to add new rows.
The top checkbox is working with no problems.
I dont know how to write the button to add the new row at the bottom of the table and create the checkbox in B
Secondly, I dont know how to write code such that if any of the checkboxes in B are checked (other than the top one) then the user entered data in C-E for that row is deleted. For user inserted rows the same function needs to exist.
If feels that there should be a more sophisticated method than simply repeating the same script for each checkbox (plus I have no idea how to add this to the user inserted one)
Many thanks all
0
Comments
-
I can't answer all of your question, but I can answer part of it.
Have each checkbox call the exact same script, and include code like this:
Dim Row As Integer
Row = ActiveSheet.Shapes(Application.Caller).TopLeftCell.Row
That will allow your script to tell which row it's working with.0 -
Thanks for the suggestion, unfortunately the controls at the moment are all ActiveX versions and so the Application.Caller etc doesnt work on them.
Ideally would prefer to code something that works with whats there than try and redesign the thing from scratch0 -
You say you have no choice, but Excel is the wrong tool for this. Push back.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.1K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.5K Work, Benefits & Business
- 602.8K Mortgages, Homes & Bills
- 178K Life & Family
- 260.5K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards
