-Polak
asked on
VBA Summing a Table Inside of a UserForm
Alright I've been at this workbook for 15 hours today and I didn't expect this to fight me... but it is. What's the correct Syntax to Sum and entire table's column in VBA for a field in my userform?
Private Sub drpFHInputMethod_Change()
If drpFHInputMethod.Value = "From Planning Dashboard" Then
txtReqFH.Value = Application.WorksheetFunction.Sum(TableFHAnalysisEngine[ApprovedHours])
txtReqFH.Locked = True
OptionButtonYes.SetFocus
Else: txtReqFH.Locked = False
txtReqFH.Value = ""
txtReqFH.SetFocus
End If
End Sub
ASKER
That threw a for me. Here's a dummy workbook. Honestly if the best/easiest way is to just have a backendsheet do the worksheet calculation and then pass that value into the User form I'm not opposed(if you look at my code a bunch of the other buttons already use a backend sheet).... I just thought it would be simple to do this all in VBA.
VBAUSerFormSumming.xlsm
VBAUSerFormSumming.xlsm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
(looks like I forgot to rename) Nice! I just learned about DatabodyRange and xlCellTypeVisible yesterday. Infact, that's how "Table 1" gets its data in the first place in the real workbook.
I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
Open in new window