ififthelement
New Member
- Joined
- Sep 11, 2014
- Messages
- 48
Hi,
I have Sheet1 which has following data:
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]a, b, c, d[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD]=FindCount(A1)[/TD]
[/TR]
</tbody>[/TABLE]
In the VBA-Project, I have a Module with following code :
Public Function FindItemCount(LinkedItems As Range)
On Error Resume Next
Dim tmpItems, curAddr
Dim indx As Integer
Dim LocOffset
tmpItems = Split(LinkedItems.Value, ", ") ' Delimiter is COMMA & SPACE
Set LocOffset = LinkedItems.Offset(0, 1) ' to set a value in B1
indx = UBound(tmpItems)
LocOffset.Value = indx ' Generates Application-defined or Object-defined Error - Why ?
' Do other necessary stuff
End Function
The intent is only to find how many items are there and update the OffSet COLUMN ( not happening) with a value of the count.
Then read read each item and do necessary work.
I have Sheet1 which has following data:
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]a, b, c, d[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD]=FindCount(A1)[/TD]
[/TR]
</tbody>[/TABLE]
In the VBA-Project, I have a Module with following code :
Public Function FindItemCount(LinkedItems As Range)
On Error Resume Next
Dim tmpItems, curAddr
Dim indx As Integer
Dim LocOffset
tmpItems = Split(LinkedItems.Value, ", ") ' Delimiter is COMMA & SPACE
Set LocOffset = LinkedItems.Offset(0, 1) ' to set a value in B1
indx = UBound(tmpItems)
LocOffset.Value = indx ' Generates Application-defined or Object-defined Error - Why ?
' Do other necessary stuff
End Function
The intent is only to find how many items are there and update the OffSet COLUMN ( not happening) with a value of the count.
Then read read each item and do necessary work.