TheOneTrueScotsman
New Member
- Joined
- Mar 21, 2021
- Messages
- 7
- Office Version
- 2016
- Platform
- Windows
(I apologize if this topic has already been addressed elsewhere)
I am very new to VBA scripting, but I have managed to write the following:
Context:
I work in the quality department of a machine shop, and I have a form I use to record part screening data consisting of 10 columns and 100 rows in order to accommodate large batches of parts. All ten columns in each row must have an input in order for PASS-FAIL evaluation to occur, and I use X as a placeholder when I have no data. I use checkboxes at the top of columns C through K [my 2 through 10] to automatically fill in said placeholder when needed (column B [my 1] is intentionally left out as it would not make sense to have one there). The script above is a sample of one of the checkboxes. It populates a fixed range, and though this is adequate, it leaves a lot of junk placeholders in the end. My request is that I'd like it to only populate as far as there is data in column B.
For instance, if I use only 20 rows of the 100 available, the columns that are checked would populate Xs only to those 20 and leave the other 80 blank. If I were to go to the next row and provide an input, the checked columns would fill just the other cells of that row in at that time, and also delete the Xs of that row were I to clear the input I just made. Thank you for any assistance you have to offer.
I am very new to VBA scripting, but I have managed to write the following:
VBA Code:
Private Sub Unused_02_Click()
If Sheet1.Unused_02.Value = True Then
Sheet1.Range("C18:C117") = "X"
Else
Sheet1.Range("C18:C117") = ""
End If
End Sub
Context:
I work in the quality department of a machine shop, and I have a form I use to record part screening data consisting of 10 columns and 100 rows in order to accommodate large batches of parts. All ten columns in each row must have an input in order for PASS-FAIL evaluation to occur, and I use X as a placeholder when I have no data. I use checkboxes at the top of columns C through K [my 2 through 10] to automatically fill in said placeholder when needed (column B [my 1] is intentionally left out as it would not make sense to have one there). The script above is a sample of one of the checkboxes. It populates a fixed range, and though this is adequate, it leaves a lot of junk placeholders in the end. My request is that I'd like it to only populate as far as there is data in column B.
For instance, if I use only 20 rows of the 100 available, the columns that are checked would populate Xs only to those 20 and leave the other 80 blank. If I were to go to the next row and provide an input, the checked columns would fill just the other cells of that row in at that time, and also delete the Xs of that row were I to clear the input I just made. Thank you for any assistance you have to offer.