dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,392
- Office Version
- 365
- 2016
- Platform
- Windows
I have a table with 32 columns to determine costings. Originally, it was going to have just one row and using that, my table was performing calculations etc correctly. There is a checkbox that allows a 10% increase to be put on the price. With only 1 row, I just set it so that if you clicked on it, it changed the value in a cell to be 1.1, and if you unselect it, changed it back to 1. There is a formula that multiplies the cell by the total to give you a 10% increase or not. When a new row is added, it made a new cell to add 1.1 to, should a 10% increase be wanted for that costing.
I have been told that the table now needs to have x number of rows so when a new row is added, there will be a new cell to determine if the new costing has the 10% increase.
Trouble is that I know how to add the 1.1 to a fixed cell but as rows can be added, the cell to determine if the price is to have the increase will change.
The table is called tblCosting and it is on a sheet called "home"
This is the code I had when there was just one row, and it was working.
There are things under the table so I can't use the xlup method to determine the last row to add the 1.1 or 1 to column AB.
Can someone help me with this please?
I have been told that the table now needs to have x number of rows so when a new row is added, there will be a new cell to determine if the new costing has the 10% increase.
Trouble is that I know how to add the 1.1 to a fixed cell but as rows can be added, the cell to determine if the price is to have the increase will change.
The table is called tblCosting and it is on a sheet called "home"
This is the code I had when there was just one row, and it was working.
Code:
Private Sub txtIncrease_Click()
Worksheets("home").Unprotect Password:="costings"
If txtIncrease.Value = True Then
Worksheets("home").Range("AB5").Value = "1.1"
Else
Worksheets("home").Range("AB5").Value = "1"
End If
'Worksheets("home").Protect Password:="costings"
End Sub
There are things under the table so I can't use the xlup method to determine the last row to add the 1.1 or 1 to column AB.
Can someone help me with this please?