Hi everyone,
I created a function in excel vba, saved it in the personal.xlsb, and it works exactly as I want it, the only problem is that it only works when I "unhide" the header row. I tried searching the problem but I couldn't find anything.
Example Table
<tbody>
</tbody>
The function code below...
The end result will be something like
<tbody>
</tbody>
The code works, perfectly, but only when I have to unhide the "header" row in my original table...
Really appreciate your help...
I created a function in excel vba, saved it in the personal.xlsb, and it works exactly as I want it, the only problem is that it only works when I "unhide" the header row. I tried searching the problem but I couldn't find anything.
Example Table
Header 1 | Header 2 | Header 3 | |
Subitem 1 | 1 | 6 | 0 |
Subitem 2 | 4 | 3 | 2 |
Subitem 3 | 1 | 5 | 0 |
Subitem 4 | 0 | 0 | 3 |
<tbody>
</tbody>
The function code below...
Code:
Public Function BOQTakeOff(subitem As Range, header As Range)
Dim txt As String
For Each cell In subitem
If cell.Value > 0 Then
txt = txt & " " & cell.Value & " x " & Cells(header.Row, cell.Column).Value & "," & vbCrLf
End If
Next cell
BOQTakeOff = txt
End Function
The end result will be something like
1 x Header 1, 6 x Header 2, |
4 x Header 1, 3 x Header 2, 2 x Header 3, |
1 x Header 1, 5 x Header 2, |
3 x Header 3, |
<tbody>
</tbody>
The code works, perfectly, but only when I have to unhide the "header" row in my original table...
Really appreciate your help...