View Single Post
 
Old 06-01-2021, 07:52 AM
JamesWood JamesWood is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Nov 2020
Posts: 37
JamesWood is on a distinguished road
Question Counting numbers in Word VBA

Hi guys


Strange one here, but any idea how to COUNTA in Word VBA, not Excel? Or the equivalent? I'm aware this sub is totally wrong but hopefully it'll get across what I want to do:


Public Function MergeFromToTotal() As String


MergeFromToTotal = CountA(Range(Me.FromThis.Value:Me.ToThis.Value))


End Function


Where Me.FromThis.Value is a textbox that might contain any number, and the same for the ToThis value. If it was say 3-6 then I'd want MergeFromToTotal to return with 4 (e.g. 3, 4, 5, 6).


Hope that makes sense?


Thanks a lot!
James
Reply With Quote