DixiePiper
New Member
- Joined
- Oct 19, 2015
- Messages
- 41
- Office Version
- 365
- Platform
- Windows
I'm not even sure how to ask this question. I am working to export data, one sheet at a time, from a variable series of worksheets to a master table on another sheet. I'm trying to design/develop a userform with the export code and a checklist to keep track of what I've done. So far the userform initializes with checkboxes based on a list of companies in a named table. If the data for that company has already been exported, there should be an "x" in the "Done" column. Right now, when the userform loads, the checkbox loads with a value of TRUE if the "Done" column contains = "x". Where I'm struggling is on how to check the box on the userform and update the "Done" column accordingly.
There are a variety of reasons this needs to be dynamic: the company list can change during the course of the project, the total lines of data on the master table can be hundreds and hundreds of rows, and I often get interrupted. I need a way to see where I am in this particular step of the project.
The code that creates the checkboxes looks like this: (Exel 2013; Windows 10)
I need to be able to check a box on the userform and then have the "finish" button update the appropriate cell in the source table. The table looks like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Done[/TD]
[TD]Company Name[/TD]
[TD]Abbr.[/TD]
[/TR]
[TR]
[TD]x[/TD]
[TD]Company A[/TD]
[TD]CompA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Company B[/TD]
[TD]CompB[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Company C[/TD]
[TD]CompC[/TD]
[/TR]
</tbody>[/TABLE]
With the above code, when the userform initializes, the checkboxes for each company appear and the checkbox for Company A is checked. However, I need to be able to check Company B on the userform and update the table accordingly.
TIA
There are a variety of reasons this needs to be dynamic: the company list can change during the course of the project, the total lines of data on the master table can be hundreds and hundreds of rows, and I often get interrupted. I need a way to see where I am in this particular step of the project.
The code that creates the checkboxes looks like this: (Exel 2013; Windows 10)
Code:
Private Sub UserForm_Initialize()
Dim newChkBx As MSForms.CheckBox
Dim rngSrc, rngCell As Range
Dim topPos As Integer
Dim maxWidth As Long
Set rngSrc = Worksheets("Admin - General").Range("Team[Abbr.]")
topPos = 90
maxWidth = 261
For Each rngCell In rngSrc
If rngCell.value <> "" Then
Set newChkBx = Me.Controls.Add("Forms.Checkbox.1")
With newChkBx
.Caption = rngCell.value
.Font.name = "Calibri"
.Font.Size = 11
.Left = 12
.Top = topPos
.AutoSize = True
If .Width > maxWidth Then maxWidth = .Width
If rngCell.Offset(, -2).value = "x" Then
newChkBx.value = True
End If
End With
topPos = topPos + 18
End If
Next rngCell
Me.Width = maxWidth
Me.Height = topPos + 36
End Sub
I need to be able to check a box on the userform and then have the "finish" button update the appropriate cell in the source table. The table looks like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Done[/TD]
[TD]Company Name[/TD]
[TD]Abbr.[/TD]
[/TR]
[TR]
[TD]x[/TD]
[TD]Company A[/TD]
[TD]CompA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Company B[/TD]
[TD]CompB[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Company C[/TD]
[TD]CompC[/TD]
[/TR]
</tbody>[/TABLE]
With the above code, when the userform initializes, the checkboxes for each company appear and the checkbox for Company A is checked. However, I need to be able to check Company B on the userform and update the table accordingly.
TIA